Created
December 28, 2020 01:56
-
-
Save hamsternik/623cab2b318c4813416f8a42f5a0c51f to your computer and use it in GitHub Desktop.
mistake #1 - forget to use `weak` memory modifier for the delegate variable
This file contains hidden or 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 UserDetailsViewControllerDelegate: class { | |
func update(with user: User) | |
} | |
final class UserDetailsViewController: UIViewController { | |
var delegate: UserDetailsViewControllerDelegate? | |
// some code below ... | |
@IBAction func didTapContinueButton(_ sender: UIButton) { | |
let user = // get new instance of the User or use the existing one | |
delegate?.update(with: user) | |
} | |
} |
Author
hamsternik
commented
Dec 28, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment