Group Group Group Group Group Group Group Group Group

raywenderlich.com Forums

macOS Development for Beginners: Part 2

Learn how an app starts, how the UI is constructed, and all the way to handling user interaction in this macOS development tutorial for beginners!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/730-macos-development-for-beginners-part-2

Excellent series. I’m a little confused about a couple of items. First, I can’t seem to increase the vertical size of the eggTimer window and I can’t seem to get the eggImage to appear. Everything else in Part 2 is working as expected down to the Menu section. Any thoughts?

Had to make 2 changes to compile in Swift 4:

in ViewController, imageToDisplay func:

- return NSImage(named: imageName)

+ return NSImage.init(named: NSImage.Name(imageName))

in ViewController, configureButtonsAndMenus func

- if let appDel = NSApplication.shared().delegate as? AppDelegate {

+ if let appDel = NSApplication.shared.delegate as? AppDelegate {

Got the app working ok, but the ‘Timer’ menu items are all disabled. Still working on it…

The two issues may be related due to auto-layout.

Does the image appear in the storyboard? If not, have you added the assets to the project and selected the “stopped” image for the NSImageView? If the “stopped” image is not appearing, how about one of the percentage images - 0, 25, 50, 75or 100?

If the image is not appearing, the image view may not resize correctly so that might be where the vertical size constraint is coming from.
Alternatively, check the settings for the Window in the Window Controller and make sure you have not set a maximum contender size for the height.

This tutorial is more than six months old so questions regarding it are no longer supported for the moment. We will update it as soon as possible. Thank you! :]

This was updated on Jun 14, 2021 by @robertomachorro, so reopening comments! :]