
MacOS beginner guide for our swiftUI Wumble Game
For our Wumble game implemented in swiftUI we created a new target in our Xcode project and it actually made us create a new Menu.xib file for the macOS menu and AppDelegate and ContentView files.
What have we done next?
From our apple store deployment we had to do some MacOS steps according to macOS Human Interface Guidelines.
- Created dock action to our app delegate with applicationShouldHandleReopen function
- Created menu action for our windows in case the close button is pressed by the user and the window had to be recreated for that we used the class below to recreate our window and add to it our rootView.
class WumbleWindowController<RootContentView : View>: NSWindowController {
convenience init(rootContentView: RootContentView) {
let hostingController = NSHostingController(rootView: rootContentView.frame(width: 880, height: 900))
let window = NSWindow(contentViewController: hostingController)
window.setContentSize(NSSize(width: 880, height: 900))
self.init(window: window)
}
}
- Make sure in the menu of your macOS app you don’t have the name of your target. We had WumbleMacOS that was not correct according to apple guidelines. Changing it to Wumble made the problem go away.
#Wumble #NLP #MACHINELEARNING #NEWFEATURES #LEARN #MACOS #NEWPOST