can class is final access and methods within class public access

Generated on 10/30/2024

1 search

In Swift, a class marked as final cannot be subclassed, meaning no other class can inherit from it. However, the access level of the class and its methods can still be controlled independently. You can have a final class with public methods, which means that while the class itself cannot be subclassed, its methods can be accessed from any module if they are marked as public.

For more details on Swift's access control and class features, you might find the session A Swift Tour: Explore Swift’s features and design helpful, particularly the section on classes.