There is an error in container.bounds where container is underlined because of unexpectedly found nil optional value
I Check the reference outlet and it's connected
What am i missing here ?
public class testViewController: UIViewController {
@IBOutlet weak var readyButton : Button!
@IBOutlet weak var container: UIView!
private var webView = WKWebView()
public init() {
super.init(nibName: "DetilSandKViewController", bundle: Bundle(for: DetilSandKViewController.self))
self.modalPresentationStyle = .overCurrentContext
self.modalTransitionStyle = .crossDissolve
}
public required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
public override func viewDidLoad() {
super.viewDidLoad()
webView.frame = container.bounds
webView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
container.addSubview(webView)
webView.scrollView.delegate = self
// Do any additional setup after loading the view.
}
public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
webView.scrollView.setContentOffset(.zero, animated: true)
}
}
extension testViewController: UIScrollViewDelegate {
}