Swift 3: The difference between Public and Internal access modifiers?

  • Internal - This is default access specifier in swift. With this we can access data members and member functions in the same module (target).

  • Public - This is where you can access all data members and member functions within same module and outside of it. But you can't subclass or override outside the module.

  • Open - same as public, only difference is you can subclass or override outside the module.

  • Fileprivate - As the name say's, data members and member functions are accessible within the same file.

  • Private - This is where you can have access within the scope of function body or class.


Whatever you marked as public can be used within your app and outside of your app(module). If you marked something as internal that can only be used within your app(module). This is very helpful when you're developing a library (framework), you can use internal to hide library structure.