Post

Replies

Boosts

Views

Activity

Why am I able to extend and override methods of NWConnection (which is a final class)?
The answer may be too obvious, and I may be asking a s*i*l*l**y* question. Please help me out understanding the issue. As per Swift documentation, final classes can be extended, but you can not override the already declared methods etc. However, it seems like I am able to do that on NWConnection. I want to understand why it is possible. Here is my code. import Network extension NWConnection { // My new method     func hello() {         print("Hello")     }     func start(queue: DispatchQueue) {         os_log("My Version is called") //Hypothetical state modification         self.stateUpdateHandler?(.setup)     } }
6
0
1.7k
Apr ’21