Created
May 22, 2020 04:14
-
-
Save peerasak-u/290fcb9aadf0cc42aba52330ccb34077 to your computer and use it in GitHub Desktop.
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
import Foundation | |
protocol PresenterView: class { | |
func updateLabel() | |
} | |
class Presenter { | |
weak var view: PresenterView? | |
// Pass something that conforms to PresenterView | |
init(with view: PresenterView) { | |
self.view = view | |
} | |
var timesTapped = 0 | |
func buttonTapped() { | |
timesTapped += 1 | |
if timesTapped >= 5 { | |
self.view?.updateLabel() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment