Created
July 19, 2020 04:18
-
-
Save olivaresf/cd41cd633aeb75e9f5c1aa2cecb2109d to your computer and use it in GitHub Desktop.
Delegation in VCs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol CurrencyPickerProtocol : class { | |
func selected(currency: String, from: CurrencyPickerTableViewController) | |
} | |
class CurrencyPickerTableViewController: UITableViewController { | |
weak var delegate: CurrencyPickerProtocol | |
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { | |
let key = order[indexPath.row] | |
delegate.selected(currency: key, from: self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment