Swift offers 5 access modifiers: open , public , internal , fileprivate and private .
From what I know about these qualifiers (mainly from link and link_2 )
open means that classes and class members can be subclassed and redefined both inside and outside the defining module (target).
fileprivate restricts the use of an entity to its defining source file. It is mainly accessible by several classes in one file.
private restricts the use of an object in its declaration.
Now public and internal seems to me almost the same: -
public means that classes and class members can only be subclassed and redefined in the defining module (target).
internal allows you to use the object in the defining module (target). In addition, it turns out to be the default specifier if nothing is mentioned. Usually we will use internal access when defining applications or the internal structure of the framework.
Basically, how do public and domestic differ?
This is my first question here, so if I missed any details, please let me know. Thanks in advance.
iCode source share