OK. I read this book (SwiftUI by tutorials) several times and now, I wanna make macOS app.
To be honest, I want to implement “Preference” button in ContentView.swift and I already made preference (honestly that’s storyboard
) using “Main.Storyboard” to link shortcut and ViewController that linked with preference.
Following this book (p.73), book’s code should works even considering UI is almost opposite of NS.
Surely I changed all of UI to NS and some things…
here is my source code
struct PreferenceRepresentaion: NSViewControllerRepresentable {
func makeNSViewController(context: NSViewControllerRepresentableContext<PreferenceRepresentaion>) -> NSViewController {
NSStoryboard(name: "Main", bundle: nil).instantiateController(identifier: "Preference") as! NSViewController
}
func updateNSViewController(_ nsViewController: NSViewController, context: NSViewControllerRepresentableContext<PreferenceRepresentaion>) {
}
}
please help me