Swift - Optional Protocol Implementation
In my previous blog, I explained the Protocol and optional protocol in a generic way. Now, we will dive deep into Protocol implementation and may be this is how the UITableViewDataSource and UITableViewDelegate would have been implemented. Objective's of this document would be to understand the optional protocol following concepts 1) Check implementation of the optional method by writing ? , after the name of the method. 2) When a method is optional it's type automatically becomes as optional. example type (Int) -> String becomes (Int) -> String? _________________________________________________________________________________ Lets start with a controller implementation , listed in the below code. There will no UI re-presentation , the protocol explanation is solely for simple understanding. 1) ProfileViewsDelegate.swift. We will be implementing the protocol for the ProfileViews.swift. import Foundation import UIKit @objc protocol Profile...