Skip to content

Instantly share code, notes, and snippets.

@peerasak-u
Created May 22, 2020 04:14
Show Gist options
  • Save peerasak-u/290fcb9aadf0cc42aba52330ccb34077 to your computer and use it in GitHub Desktop.
Save peerasak-u/290fcb9aadf0cc42aba52330ccb34077 to your computer and use it in GitHub Desktop.
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