macOS programming (2)

April 26, 2017

I am going to use this blog as a bit of a reference point as I learn about macOS programming.

View Life Cycle

There is something called the view life cycle. It is basically the event chain of your application. I saved this helpful image:

Logging (akin to console.log on the web)

You can print messages to the console using print() in Swift 3.2. It used to be println() in earlier versions of Swift.

Actions and outlets aka event binding

To hook up parts of the UI you can create “outlets”. Outlets go from UI element to code. Then you can create “actions”. Actions go from code to the UI. The connection created is a bit like event binding in Javascript.

If you want to change something it’s important not to just delete the code without cleaning up the automated references. Xcode automatically generates some code in the background. (todo: figure out how to do that 😅).

I tried my best to capture this in a Youtube video, because I had to piece together various resources to get this:

Language reference

Apple provides a book on Swift. You can download it using iBooks.

I know I won’t keep an interest in learning a language theoretically but it’s good to be able to reference this.

That’s it for today. Over & out.

Leave a Reply

Your email address will not be published. Required fields are marked *