Skip to content

Commit cbf02e8

Browse files
committed
fix duplicated RxWKNavigationDelegateProxy in RxSwift and RxWebKit
1 parent 4f70b83 commit cbf02e8

File tree

2 files changed

+10
-59
lines changed

2 files changed

+10
-59
lines changed

Sources/RxWebKit/RxWKNavigationDelegateProxy.swift

Lines changed: 0 additions & 44 deletions
This file was deleted.

Sources/RxWebKit/WKNavigationDelegateEvents+Rx.swift

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,9 @@ extension Reactive where Base: WKWebView {
4343
/// WKNavigationActionPolicyEvent emits a tuple event of WKWebView + WKNavigationAction + ActionHandler
4444
public typealias WKNavigationActionPolicyEvent = ( webView: WKWebView, action: WKNavigationAction, handler: ActionHandler)
4545

46-
/// Reactive wrapper for `navigationDelegate`.
47-
public var delegate: DelegateProxy<WKWebView, WKNavigationDelegate> {
48-
return RxWKNavigationDelegateProxy.proxy(for: base)
49-
}
50-
5146
/// Reactive wrapper for delegate method `webView(_ webView: WKWebView, didCommit navigation: WKNavigation!)`.
5247
public var didCommitNavigation: ControlEvent<WKNavigationEvent> {
53-
let source: Observable<WKNavigationEvent> = delegate
48+
let source: Observable<WKNavigationEvent> = navigationDelegate
5449
.methodInvoked(.didCommitNavigation)
5550
.map { arg in
5651
let view = try castOrThrow(WKWebView.self, arg[0])
@@ -62,7 +57,7 @@ extension Reactive where Base: WKWebView {
6257

6358
/// Reactive wrapper for delegate method `webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!)`.
6459
public var didStartProvisionalNavigation: ControlEvent<WKNavigationEvent> {
65-
let source: Observable<WKNavigationEvent> = delegate
60+
let source: Observable<WKNavigationEvent> = navigationDelegate
6661
.methodInvoked(.didStartProvisionalNavigation)
6762
.map { arg in
6863
let view = try castOrThrow(WKWebView.self, arg[0])
@@ -74,7 +69,7 @@ extension Reactive where Base: WKWebView {
7469

7570
/// Reactive wrapper for delegate method `webView(_ webView: WKWebView, didFinish navigation: WKNavigation!)`
7671
public var didFinishNavigation: ControlEvent<WKNavigationEvent> {
77-
let source: Observable<WKNavigationEvent> = delegate
72+
let source: Observable<WKNavigationEvent> = navigationDelegate
7873
.methodInvoked(.didFinishNavigation)
7974
.map { arg in
8075
let view = try castOrThrow(WKWebView.self, arg[0])
@@ -87,15 +82,15 @@ extension Reactive where Base: WKWebView {
8782
/// Reactive wrapper for delegate method `webViewWebContentProcessDidTerminate(_ webView: WKWebView)`.
8883
@available(iOS 9.0, *)
8984
public var didTerminate: ControlEvent<WKWebView> {
90-
let source: Observable<WKWebView> = delegate
85+
let source: Observable<WKWebView> = navigationDelegate
9186
.methodInvoked(.didTerminate)
9287
.map { try castOrThrow(WKWebView.self, $0[0]) }
9388
return ControlEvent(events: source)
9489
}
9590

9691
/// Reactive wrapper for delegate method `webView(_ webView: WKWebView, didReceiveServerRedirectForProvisionalNavigation navigation: WKNavigation!)`.
9792
public var didReceiveServerRedirectForProvisionalNavigation: ControlEvent<WKNavigationEvent> {
98-
let source: Observable<WKNavigationEvent> = delegate
93+
let source: Observable<WKNavigationEvent> = navigationDelegate
9994
.methodInvoked(.didReceiveServerRedirectForProvisionalNavigation)
10095
.map { arg in
10196
let view = try castOrThrow(WKWebView.self, arg[0])
@@ -107,7 +102,7 @@ extension Reactive where Base: WKWebView {
107102

108103
/// Reactive wrapper for delegate method `webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error)`.
109104
public var didFailNavigation: ControlEvent<WKNavigationFailEvent> {
110-
let source: Observable<WKNavigationFailEvent> = delegate
105+
let source: Observable<WKNavigationFailEvent> = navigationDelegate
111106
.methodInvoked(.didFailNavigation)
112107
.map { arg in
113108
let view = try castOrThrow(WKWebView.self, arg[0])
@@ -120,7 +115,7 @@ extension Reactive where Base: WKWebView {
120115

121116
/// Reactive wrapper for delegate method `webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error)`.
122117
public var didFailProvisionalNavigation: ControlEvent<WKNavigationFailEvent> {
123-
let source: Observable<WKNavigationFailEvent> = delegate
118+
let source: Observable<WKNavigationFailEvent> = navigationDelegate
124119
.methodInvoked(.didFailProvisionalNavigation)
125120
.map { arg in
126121
let view = try castOrThrow(WKWebView.self, arg[0])
@@ -148,7 +143,7 @@ extension Reactive where Base: WKWebView {
148143
credential.
149144
@discussion If you do not implement this method, the web view will respond to the authentication challenge with the NSURLSessionAuthChallengeRejectProtectionSpace disposition.
150145
*/
151-
let source: Observable<WKNavigationChallengeEvent> = delegate
146+
let source: Observable<WKNavigationChallengeEvent> = navigationDelegate
152147
.sentMessage(.didReceiveChallenge)
153148
.map { arg in
154149
/// Extracting the WKWebView from the array at index zero
@@ -205,7 +200,7 @@ extension Reactive where Base: WKWebView {
205200
/// Reactive wrapper for `func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Swift.Void)`
206201
public var decidePolicyNavigationResponse: ControlEvent<WKNavigationResponsePolicyEvent> {
207202
typealias __DecisionHandler = @convention(block) (WKNavigationResponsePolicy) -> ()
208-
let source:Observable<WKNavigationResponsePolicyEvent> = delegate
203+
let source:Observable<WKNavigationResponsePolicyEvent> = navigationDelegate
209204
.methodInvoked(.decidePolicyNavigationResponse).map { args in
210205
let view = try castOrThrow(WKWebView.self, args[0])
211206
let response = try castOrThrow(WKNavigationResponse.self, args[1])
@@ -225,7 +220,7 @@ extension Reactive where Base: WKWebView {
225220
/// Reactive wrapper for `func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Swift.Void)`
226221
public var decidePolicyNavigationAction: ControlEvent<WKNavigationActionPolicyEvent> {
227222
typealias __ActionHandler = @convention(block) (WKNavigationActionPolicy) -> ()
228-
let source:Observable<WKNavigationActionPolicyEvent> = delegate
223+
let source:Observable<WKNavigationActionPolicyEvent> = navigationDelegate
229224
.methodInvoked(.decidePolicyNavigationAction).map { args in
230225
let view = try castOrThrow(WKWebView.self, args[0])
231226
let action = try castOrThrow(WKNavigationAction.self, args[1])

0 commit comments

Comments
 (0)