Skip to content

Instantly share code, notes, and snippets.

@nikolaykasyanov
Created April 6, 2018 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikolaykasyanov/0236d8889f8e1f7e57f04ed1a27daa0c to your computer and use it in GitHub Desktop.
Save nikolaykasyanov/0236d8889f8e1f7e57f04ed1a27daa0c to your computer and use it in GitHub Desktop.
protocol ReachabilityDelegate: class {
func reachabilityDidChange(_ reachable: Bool)
}
class Reachability {
weak var delegate: ReachabilityDelegate?
}
class Model: ReachabilityDelegate {
func reachabilityDidChange(_ reachable: Bool) {
print("what's up?")
}
}
// this happens in factory
let reachability = Reachability()
let model = Model()
reachability.delegate = model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment