Post

Replies

Boosts

Views

Activity

Two windows from the beginning
(macOS, Swift, storyboards)How can I have two windows open from the beginning? (without clicking any button)What I have tried:1- CREATE A NEW WINDOW- Main.storyboard I have a Window Controller from the library- I have created a New document Cocoa Class SecondViewController- Main.storyboard > I select View Controller. In Identity Inspector I select Class SecondViewController2- MAKE IT LAUNCH FROM THE BEGINNING- AppDelegate.swift inside applicationDidFinishLaunching: let storyboard = NSStoryboard(name: "Main", bundle: nil) let windowController = storyboard.instantiateController(withIdentifier: "MySecondController") as! NSWindowController windowController.showWindow(self)- I think my problem is how to identify MySecondController in Main.storyboardI tried to select Window inside Window Controller. Then go to Identity Inspector and Identifier. But when I run, it does not appear. How should I identify that second window, where exactly should I put MySecondController name? Or perhaps I have not created well the second window?
3
0
2.1k
Dec ’19
WKWebView and the sandbox
(Swift, macOS, storyboard)I just try to display a web site inside the app. But I see nothing. It fails silentlyimport Cocoa import WebKit class ViewController: NSViewController { @IBOutlet weak var webView: WKWebView! override func viewDidLoad() { super.viewDidLoad() let url = URL(string: "https://www.apple.com") let request = URLRequest(url:url!) webView.load(request) } }There is a similar question here:https://forums.developer.apple.com/thread/92265It talks about the sandbox but I do not understand what I have to do. What I have to select and why?Thank you
5
0
3.1k
Nov ’19