Zaid Pathan
Aug 25, 2017 · 1 min read

Yes, agreed on this point, open is not always needed.

open is only needed when you want to subclass any class, which is most common in reusable code.

Difference between open and public by Apple:

Open access applies only to classes and class members, and it differs from public access as follows:

Classes with public access, or any more restrictive access level, can be subclassed only within the module where they’re defined.

Class members with public access, or any more restrictive access level, can be overridden by subclasses only within the module where they’re defined.

Open classes can be subclassed within the module where they’re defined, and within any module that imports the module where they’re defined.

Open class members can be overridden by subclasses within the module where they’re defined, and within any module that imports the module where they’re defined.

Feeling good that it helped you :)

)

    Zaid Pathan

    Written by