Welcome to the forum.
Please format code with code formatter, that will make it much easier to read.
You are mixing UIKit and SwiftUI and you are missing several points:
- Where did you define ContentView struct ?
- you need to make your ViewController UIViewControllerRepresentable
See how to organize all this here: https://sarunw.com/posts/uiviewcontroller-in-swiftui/
Here is the complete code to make it work. @main is unchanged.
import SwiftUI
import UIKit
import WebKit
class MyViewController: 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.makeupistry.com/toolbar")
let myRequest = URLRequest(url: myURL!)
webView.load(myRequest)
}
}
struct MyView: UIViewControllerRepresentable {
typealias UIViewControllerType = MyViewController
func makeUIViewController(context: Context) -> MyViewController {
let vc = MyViewController()
// Do some configurations here if needed.
return vc
}
func updateUIViewController(_ uiViewController: MyViewController, context: Context) {
// Updates the state of the specified view controller with new information from SwiftUI.
}
}
struct ContentView: View {
var body: some View {
MyView()
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}

To avoid warnings, you should set SceneConfiguration as shown below (you can also do it directly in the Info file):

You may face another problem with WKWebView when loading and get the following error of just a blank screen:
2023-02-02 18:20:09.429496+0100 TEST[7508:3721208] [Security] This method should not be called on the main thread as it may lead to UI unresponsiveness.
That's a long standing issue: https://developer.apple.com/forums/thread/712074