Created
August 11, 2018 14:34
-
-
Save leoiphonedev/c05192bf1edd2caa47718722f9a289d5 to your computer and use it in GitHub Desktop.
Implementing NSKeyValueObserving function
This file contains 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
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