WKWebView Autolayout with magnification

When a magnification is altered from default 1.0 (100%) I'm trying to maintain my orignal layout - set in IB like so:


    func fit(_ childView: NSView, parentView: NSView) {
        childView.translatesAutoresizingMaskIntoConstraints = false
        childView.topAnchor.constraint(equalTo: parentView.topAnchor).isActive = true
        childView.leadingAnchor.constraint(equalTo: parentView.leadingAnchor).isActive = true
        childView.trailingAnchor.constraint(equalTo: parentView.trailingAnchor).isActive = true
        childView.bottomAnchor.constraint(equalTo: parentView.bottomAnchor).isActive = true
    }


where the childView is the webView and its parent container view - fit() called from viewDidLoad(). The result is the view is pegged to top left, nice but I'like the window content to match the now smaller or larger webView - using scroll bars if needbe. Any user attempt to resize window, being to skew the layout until they resume default.


Can someone suggestt how to go about supporting magnification ?

Web views are not like other views. Many of the tricks that you use with other types of views won't work. The best solution is to take whatever you are trying to accomplish and use an HTML/CSS/Javascript solution inside the web view instead. In many cases, you will find it easier to do in HTML and/or much more powerful.

I neglected to mention this is MacOS, where resources re: the new view are pretty sparse, but thanks.

WKWebView Autolayout with magnification
 
 
Q