I understand that internal
means that the property can only be accessed by the Swift code, and private
means that the property can only be accessed by that file, but doesn't public
basically mean the same thing as internal
? What other than the Swift script would want to access the property?
Public access enables entities to be used within any source file from their defining module, and also in a source file from another module that imports the defining module. You typically use public access when specifying the public interface to a framework.
Internal access enables entities to be used within any source file from their defining module, but not in any source file outside of that module. You typically use internal access when defining an app’s or a framework’s internal structure.
Private access restricts the use of an entity to its own defining source file. Use private access to hide the implementation details of a specific piece of functionality.