Hi,
I am trying to create web app for iOS like an app of my website when someone open a app its shows my website.
I am using code give by app developer website web view code:
code in content view.swift file
import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {
var webView: WKWebView!
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
let myURL = URL(string:"https://www.apple.com")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
}}
its not showing any error in above code
but in my app.swift file it show error. Cannot find 'ContentView' in scope
import SwiftUI
@available(iOS 14.0, *)
@main
struct Yash_RisingApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
in this if I remove the code line " ContentView(). "
it successfully built on iPhone but showing blank white page not my website opening
I hope I clear my issue
Waiting for the solution.