Skip to content

Instantly share code, notes, and snippets.

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 leoiphonedev/c05192bf1edd2caa47718722f9a289d5 to your computer and use it in GitHub Desktop.
Save leoiphonedev/c05192bf1edd2caa47718722f9a289d5 to your computer and use it in GitHub Desktop.
Implementing NSKeyValueObserving function
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "loading" {
if webView.isLoading {
activityIndicator.startAnimating()
activityIndicator.isHidden = false
} else {
activityIndicator.stopAnimating()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment