In Swift, there are five types of access modifiers: private, fileprivate, internal, public, open. Where Fileprivate and open are newly added to Swift 3. Because the previous access control is file-based, it is not class-based. This can be problematic, so Swift 3 adds two modifiers, which subdivide the original private and public.
The ranking from high to Low is as follows:
Open > Public > Interal > Fileprivate > Private
(1) Private: a modified property or method can only be accessed in the current class.
(2) Fileprivate: The Modified property or method can only be accessed in the current file. If a file contains more than one class, it can be accessed.
(3) Internal: Default access level, can write not write.
The decorated properties and methods can be accessed throughout the source code of the module.
If it is a frame or library code, it can be accessed throughout the framework and not accessible outside the framework.
If it's an app code, it's accessible throughout the app.
(4) Public: can be accessed by any code. But other modules can not be override and inherit, but within the module can be override and inherit.
(5) Open: can be accessed by any module's code, including override and inheritance.
Swift-----Access Control (private, fileprivate, internal, public, open)