W1528 Private Means Private
Access control is used to restrict access to an entity in an effort to enforce users of your code (clients) to utilize it through a (hopefully) well-planned, well-defined, and well-implemented interface rather than through direct access to all properties and methods. Limiting access is a useful tool to implement information hiding, with the goal of enabling clients to more easily use the entity while simultaneously enabling resilience (stability of the code base in response to isolated changes in an implementation).
Swift defines access control relative to modules and source files. A module is a unit of code distribution and can be imported using the import (for example Igis and Scenes. A source file is a single Swift source code file within the module.
Swift provides five different access levels for entities:
|private||enclosing declaration only|
+ extensions of declaration in same file
+ subclass outside module
+ override outside module
- Refactor your application using appropriate access modifiers by producing a well-planned, well-defined, and well-implemented interface and hiding all other methods and properties.