Updated 30 April 2021
1) Open:- It has the highest access level means it is the least restrictive. It provides access levels from other modules and files.
2) Public:-It is almost similar to open but unlike open which is subclassed and override from other modules. By using the public we can not subclassed and override from defining modules.
Let takes an example to differentiate between Open and Public.
3) internal:- It is default access control. The method or class which declares internal can be accessed from anywhere within the same module.
For Example
4) filePrivate:- The fileprivate gives accessibility within one single swift file.
For Example
5) private:- It has the lowest access level means it is the highest restrictive. It restricts the entity to the enclosing declaration. According to swift doc “Use private access to hide the implementation details of a specific piece of functionality when those details are used only within a single declaration.”
For example
You can also check other blogs from here. if you have any issue or suggestion you can leave your query/suggestion in the comment section.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.