From a69d756daf264a7152a985958c868b367f4c4bf7 Mon Sep 17 00:00:00 2001 From: Econa77 Date: Mon, 4 Jan 2021 00:19:54 +0900 Subject: [PATCH] Add support for RxSwift 6 --- Cartfile | 2 +- Cartfile.resolved | 6 +++--- Example/FailedRequestViewController.swift | 2 +- Example/InvokeJSFunctionViewController.swift | 20 ++++++++++++-------- Example/RedirectViewController.swift | 2 +- README.md | 2 +- RxWebKit.podspec | 6 +++--- 7 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Cartfile b/Cartfile index 6a8bfd6..bcb3591 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "ReactiveX/RxSwift" ~> 5.0 +github "ReactiveX/RxSwift" ~> 6.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index dc79ad3..6e8c82c 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ -github "Quick/Nimble" "v8.0.7" -github "Quick/Quick" "v2.2.0" -github "ReactiveX/RxSwift" "5.1.1" +github "Quick/Nimble" "v9.0.0" +github "Quick/Quick" "v3.0.0" +github "ReactiveX/RxSwift" "6.0.0" diff --git a/Example/FailedRequestViewController.swift b/Example/FailedRequestViewController.swift index 5580dbd..44fc363 100644 --- a/Example/FailedRequestViewController.swift +++ b/Example/FailedRequestViewController.swift @@ -23,7 +23,7 @@ class FailedRequestViewController: UIViewController { wkWebView.rx .didFailProvisionalNavigation - .observeOn(MainScheduler.instance) + .observe(on: MainScheduler.instance) .debug("didFailProvisionalNavigation") .subscribe(onNext: { [weak self] webView, navigation, error in guard let self = self else { return } diff --git a/Example/InvokeJSFunctionViewController.swift b/Example/InvokeJSFunctionViewController.swift index 069bdf9..d2c562f 100644 --- a/Example/InvokeJSFunctionViewController.swift +++ b/Example/InvokeJSFunctionViewController.swift @@ -43,14 +43,18 @@ class InvokeJSFunctionViewController : UIViewController { super.viewDidLoad() view.addSubview(webview) self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Invoke", style: .plain, target: nil, action: nil) - self.navigationItem.rightBarButtonItem?.rx.tap.bind { [weak self] in - guard let self = self else { return } - self.webview.rx.evaluateJavaScript("presentAlert()").observeOn(MainScheduler.asyncInstance).subscribe { event in - if case .next(let body) = event, let message = body as? String { - print(message) - } - }.disposed(by: self.bag) - }.disposed(by: self.bag) + self.navigationItem.rightBarButtonItem?.rx.tap + .bind { [weak self] in + guard let self = self else { return } + self.webview.rx.evaluateJavaScript("presentAlert()") + .observe(on: MainScheduler.asyncInstance) + .subscribe { event in + if case .next(let body) = event, let message = body as? String { + print(message) + } + }.disposed(by: self.bag) + } + .disposed(by: self.bag) webview.loadHTMLString(html, baseURL: nil) } diff --git a/Example/RedirectViewController.swift b/Example/RedirectViewController.swift index cb4600c..ad6ce61 100644 --- a/Example/RedirectViewController.swift +++ b/Example/RedirectViewController.swift @@ -24,7 +24,7 @@ class RedirectViewController: UIViewController { wkWebView.rx .didReceiveServerRedirectForProvisionalNavigation - .observeOn(MainScheduler.instance) + .observe(on: MainScheduler.instance) .debug("didReceiveServerRedirectForProvisionalNavigation") .subscribe(onNext: { [weak self] webView, navigation in guard let self = self else { return } diff --git a/README.md b/README.md index 8072486..dd388b2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ $(SRCROOT)/carthage/Build/iOS/RxWebKit.framework ## Requirements -RxWebKit requires Swift 5.2.2 and dedicated versions of RxSwift 5.1.1 +RxWebKit requires Swift 5.2.2 and dedicated versions of RxSwift 6.0.0 ## License diff --git a/RxWebKit.podspec b/RxWebKit.podspec index 082da4c..5d24629 100644 --- a/RxWebKit.podspec +++ b/RxWebKit.podspec @@ -36,9 +36,9 @@ Pod::Spec.new do |s| s.source = { :git => "https://github.com/RxSwiftCommunity/RxWebKit.git", :tag => s.version.to_s } s.source_files = "RxWebKit/Sources/**/*.{swift}" s.exclude_files = "RxWebKit/Sources/**/*.{plist}" - s.ios.deployment_target = '8.0' + s.ios.deployment_target = '9.0' s.osx.deployment_target = '10.13' s.swift_version = '5.0' - s.dependency 'RxSwift', '~> 5.0' - s.dependency 'RxCocoa', '~> 5.0' + s.dependency 'RxSwift', '~> 6.0' + s.dependency 'RxCocoa', '~> 6.0' end