Skip to content

Instantly share code, notes, and snippets.

@liuzhida33
Created November 12, 2018 04:35
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 liuzhida33/7fd12294396388e9a542a9cd40136327 to your computer and use it in GitHub Desktop.
Save liuzhida33/7fd12294396388e9a542a9cd40136327 to your computer and use it in GitHub Desktop.
WKWebview 添加loading和estimatedProgress rx属性
extension Reactive where Base: WKWebView {
var loading: Observable<Bool> {
return observeWeakly(Bool.self, "loading", options: [.initial, .new]).map { $0 ?? false }
}
var estimatedProgress: Observable<Double> {
return observeWeakly(Double.self, "estimatedProgress").map { $0 ?? 0 }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment