What is the final class in Swift?

Gurjit Singh
2 min readDec 20, 2023
Photo by Headway on Unsplash

In Swift, the final keyword is used to indicate that a class, method, or property cannot be overridden or subclassed. When you declare a class as final, it means that it's the end of the inheritance chain for that class, and it cannot be subclassed further.

Final Class:

final class MyClass {
// Class definition
}

--

--

Gurjit Singh

I’m Computer Science graduate and an iOS Engineer who writes about Swift and iOS development. Follow me on twitter @gurjitpt and for more articles www.gurjit.co