hello, hope you are all doing fine, i have created...
# multiplatform
r
hello, hope you are all doing fine, i have created a kmm project which has commonmain, androidmain and iosmain i have created a swift class in iosmain folder but i am not able to access it or use it from ios project my class as follows inside shared/src/iosmain :-
Copy code
import UIKit
import WebKit

public class MyWebViewViewController: UIViewController, WKNavigationDelegate {
    var webView: WKWebView!

    override func loadView() {
        webView = WKWebView()
        webView.navigationDelegate = self
        view = webView
        
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let url = URL(string: "<https://www.example.com>") // Replace with your desired URL
        let request = URLRequest(url: url!)
        webView.load(request)//dsds
        
    }

    // WKNavigationDelegate methods can be implemented here for handling web view navigation events
}
if any one know this please thanks in advance
Anyone?
j
What gave you the impression that this should work? Only Kotlin code will be compiled in your KMP src paths. And KMP doesn't support direct interop with Swift (yet). You can use Objective-C code, including Swift code with the
@objc
attribute, from Kotlin. But you'll need to compile it as a framework and add the framework to your project to generate Kotlin bindings via C interop. I recently described how to do this here.
👍 1
r
Thanks brother