Swift - Custom Type final class


Swift allows you to put restrictions on subclassing your classes and their methods and properties.

The final keyword prevents a member or class from being overridden in a subclass:

final class FinalClass {} 

You don't have to lock down the entire class if only some parts need to be restricted:

class PartiallyFinalClass { 
    final func doStuff(){ 
        print("doing stuff") 

Related Topics