Skip to content

If you use the properties implemented in RxWebKit together with the properties implemented in RxCocoa, it will crash. #52

@keisukeYamagishi

Description

@keisukeYamagishi

Please check to the following log for the runtime.

2021-10-28 19:14:34.228664+0900 RxWebKitSample[2594:65726] RxCocoa/RxCocoa.swift:153: Fatal error: Failure converting from Optional(<RxCocoa.RxWKNavigationDelegateProxy: 0x600003ec4900>) to RxWKNavigationDelegateProxy
(lldb) 

The sample code is attached below.

import UIKit
import RxSwift
import RxCocoa
import RxWebKit
import WebKit

class ViewController: UIViewController {

    @IBOutlet weak var webView: WKWebView!
    let disposeBag = DisposeBag()

    override func viewDidLoad() {
        super.viewDidLoad()
        
        webView.load(URLRequest(url: URL(string: "https://google.com")!))
        
        webView.rx
            .didStartLoad // <- This property is implementing at the RxCocoa
            .subscribe { value in
                print("value: \(value)")
            }.disposed(by: disposeBag)
        
        webView.rx
            .didStartProvisionalNavigation // <- This property is implementing at the RxWebKit
            .asObservable()
            .subscribe { (webView: WKWebView, navigation: WKNavigation) in
                print("web: \(webView)")
                print("navigation: \(navigation)")
            }.disposed(by: disposeBag)
        // Do any additional setup after loading the view.
    }
}

The image of the runtime is attached below.

Screen Shot 2021-10-28 at 19 22 41

Error log bellow

Thread 1: Fatal error: Failure converting from Optional(<RxCocoa.RxWKNavigationDelegateProxy: 0x600003ec4900>) to RxWKNavigationDelegateProxy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions