OSX Dev Daily — http://bit.ly/osx-dev-daily

100 days of OSX Development video tutorials

Learn to build Mac App using Swift

Harry Ng
macOS App Development
7 min readMar 21, 2016

--

Like learning anything, stay focused and practice regularly are the best ways. This is a story on how I learned OSX Development in the past 4 months.

EDIT: The new macOS App Development series has started here.

Reasons of Mac App Development

I spent the past few years in developing iOS apps and teaching web development classes. About 4 months ago, I was given a project to work on a startup idea, where it worked out as a Mac App. At that moment, while I thought it can be built by Swift, and the Cocoa framework should sound similar to Cocoa Touch on iOS. I accepted the project and took a month to create the first Mac App. In the meantime, I was looking for some tutorials on OSX Development. The resources were not as abundant as iOS. I thought it might be a good idea to keep my learnings as sharable resources. Today, I have just created 100 videos on what I learned every day.

Check out my tutorial series on YouTube

What do you need to start Mac App Development?

  • Xcode
  • Mac OSX

That’s it. The upside of developing Mac App is that you have the device already, the Mac computer. You don’t need to equip yourself with another device, like a iPhone. With the personal certificate available, you might register the Apple developer account later on, when you want to deploy the app to Mac App Store.

Instead, like learning any other things, patient and consistency are really important in working on OSX development. You will see why in a later part of this article.

Why is good to keep an eye on Mac App?

One of the advantages for Apple ecosystem is that developers get paid more by developing useful apps. To compare the same products for its iOS version and Mac version, the later generally charges 3 to 4 times more. Some types like todo list apps, calendars or mailboxes get paid quite well in sustaining their development teams. Some of the Mac apps I really like and use it day-by-day include Toggl, Evernote, Sketch, Dropbox, 1Password, Clear, FantasticCal. Other apps like Bartender, Caffeine, Screenflow, RescueTime are my tools of choice.

Was OSX Dev easy to learn?

No.

I thought it would be similar to iOS development. It was okay if you looked as the basic controls like TextField, Labels or Sliders. When it comes to NSCollectionView (which was updated a lot in WWDC 2015), NSTableView and Data Bindings, there are a lot of differences.

Simply saying, although the class names and the function signatures look similarly, they have quite different structure. In OSX, NSCollectionView and NSTableView are scrollable, but they are NOT subclasses of NSScrollView. Instead, they are subviews (called documentView) in the hierarchy of the scroll view, and then the clip view. (Terminologies start to add up).

Data Binding is another concept used in OSX for a long, long time. It is now regarded as legacy support. (It is shown in the documentation of the revised implementation of NSCollectionView). Indeed, there are still many examples in using Data Binding.

Besides structure difference, another big challenge is the code reference. Like any other programming experience, I found answers in google. It sometimes goes to stackoverflow, but it always goes to some old forums, that might be running since 2000 (16 years ago). Don’t expect to find any syntax highlighting there. Having indentation is already a big thumb up. In such case, don’t even to expect much on coding examples written in Swift. Luckily, I started iOS development as Objective-C developer. I am still able to read Objective-C, but mainly writing Swift code now.

What are some good resources in building Mac App?

I looked up for many resources on OSX Dev. There are a lot of resources. However, many of them are scattered. They appeared across 10–15 years. I knew some OSX developers now, who have been working in the field for more than 10 years. They are all having better experience than I do, by going ups and downs in these years.

In such case, learning the structure of Cocoa frameworks is quite important. When looking at the resources, you will need to first identify the relevance in terms of time. For example, in NSCollectionView, you may want to make sure the content is relevant to the updates in 2015. I found many people having similar questions as I did, thus I created a separate playlist just for NSCollectionView 2015. In no particular order, these are some other resources I take reference to.

  1. WWDC — It’s the most direct way to learn about OSX. As an iOS developer, it is best to start with Session 233 Sharing code between iOS and OSX (2014) and the equivalent in 2013. I watched more than 15 OSX sessions between 2011 and 2015.
  2. The Big Nerd Ranch Guide — This is almost the most structured guide in the market. It updated to Swift 1.x, and has a companion Github repo for latest Swift update. As a port from Objective-C to Swift, you would see many sections are using Nibs instead of Storyboards, together with some other legacy ways.
  3. Ray Wenderlich — Although the main focus of the blog is iOS, which is trendy, it has some articles that cover some foundation concepts in OSX.

What’s up next?

Sorry, I was so caught up with startup works. Thus, I am not accepting this request anymore. Thanks everyone for sending me emails and requests.

As I have just made 100 videos, almost doing it every day including holidays, I am looking for new ideas in the video series. Here, I want to try an experiment, inspired by Natasha the Robot.

How it works?

  1. First in, first out
  2. Send me an email to harryworld@gmail.com
  3. Write the subject as “I have a Mac App idea”
  4. Include the app idea in 3 sentences and a wireframe
  5. I will reply everyone’s email, once I decide to work on your project, I will setup a Skype call with you
  6. Payment: $250 up front, $250 on completion
  7. Design: I’ll mainly use the native UI components, open to discuss if you have a design too.
  8. You own the code, but I will take video and showcase some of the features in my blog.
  9. I have the right to choose the project to work on.

Let me know if you have any question, I will answer that as responses here.

Topics of the tutorials

To conclude this post, I am going to list the topics I have created.

  1. Storyboard
  2. Auto Layout
  3. NSCollectionView
  4. NSTableView
  5. NSTableView — Add a row
  6. Array Controller
  7. Menu Bar
  8. Menu Bar — Event Monitoring
  9. NSOutlineView
  10. NSOutlineView — Drag & Drop
  11. NSOutlineView — Undo Manager
  12. NSOutlineView — Delegate Methods
  13. NSAlert
  14. UI Testing
  15. Unit Testing
  16. ContainerView
  17. ContainerView — NSViewController Lifecycle methods
  18. NSNotification
  19. NSNotification Best Practices
  20. NSPopover
  21. NSPopover Actions
  22. NSPopover w/ NSNotification UserInfo
  23. Window Controller
  24. Tab View Controller
  25. Split View Controller
  26. NSToolbar
  27. NSToolbar Transparency
  28. Cocoa Binding Part 1/3
  29. Cocoa Binding Part 2/3
  30. Cocoa Binding Part 3/3
  31. NSCollectionView 2015 — Flow Layout
  32. NSCollectionView 2015 — Selection & Highlight
  33. NSCollectionView 2015 — Grid Layout
  34. NSCollectionView 2015 — Custom Layout
  35. NSCollectionView 2015 — Header and Footer
  36. NSCollectionView 2015 — Custom Title for Header and Footer
  37. NSCollectionView 2015 — Set Item Value / Move Item
  38. NSCollectionView 2015 — Insert Item
  39. NSCollectionView 2015 — Delete Item
  40. NSCollectionView 2015 — Scrolling
  41. NSCollectionView 2015 — Modify Text Field inline
  42. NSCollectionView 2015 — NSTrackingArea
  43. Event Handling — Key Events
  44. Event Handling — Mouse Events
  45. Event Handling — Gesture Recognizer
  46. NSView
  47. Core Animation — 3D Drawing
  48. Event Handling — Custom Gesture Recognizer
  49. Font System
  50. CocoaPods
  51. CocoaSwiftPlayer — Get Started
  52. CocoaSwiftPlayer — Start with Storyboard
  53. CocoaSwiftPlayer — Setup Controls
  54. CocoaSwiftPlayer — Start Coding
  55. CocoaSwiftPlayer — Import Songs
  56. CocoaSwiftPlayer — Display Songs
  57. CocoaSwiftPlayer — Play Song
  58. CocoaSwiftPlayer — Next Rewind
  59. CocoaSwiftPlayer — Repeat Play
  60. CocoaSwiftPlayer — Shuffle Play
  61. CocoaSwiftPlayer — Show Song Progress
  62. CocoaSwiftPlayer — Show Song Title
  63. CocoaSwiftPlayer — Playlist
  64. CocoaSwiftPlayer — Playlist in Realm
  65. CocoaSwiftPlayer — Add to Playlist
  66. CocoaSwiftPlayer — Switch & Rename Playlist
  67. CocoaSwiftPlayer — Delete using Menu
  68. CocoaSwiftPlayer — Status Bar App
  69. CocoaSwiftPlayer — Visual Effects
  70. CocoaSwiftPlayer — Wrapping Up
  71. CocoaSwiftPlayer — Bonus
  72. NSOutlineView — Insert/Remove/Move
  73. CocoaSwiftPlayer — AppIcon & Release
  74. NSTimer
  75. NSUserDefaults
  76. Multiple Windows
  77. CocoaSwiftPlayer — Bonus 2
  78. NSCollectionView 2015 — Drag & Drop
  79. NSCollectionView 2015 — Insert / Delete
  80. NSTableView — Sorting
  81. NSTableView — Searching
  82. NSCollectionView 2015— Dragging Image
  83. AutoLayout — NSLayoutConstraint
  84. AutoLayout — SnapKit
  85. NSTableView — Searching without ArrayController
  86. NSCollectionView 2015 — NSScrollView
  87. NSCollectionView 2015 — NSScrollView Part 2
  88. NSCollectionView 2015 — Design Tips
  89. NSCollectionView 2015 — IBDesignable
  90. NSTextField
  91. NSTextField Subclass
  92. NSTextField vs NSTextView
  93. NSControl — NSPopUpButton
  94. NSControl — NSComboBox
  95. NSControl — NSTextView
  96. NSControl — NSSlider
  97. NSControl — NSDatePicker
  98. NSControl — NSButton — Radio Button Group
  99. NSControl — Checkbox and Submit the Form
  100. NSImageView
  101. Event Handling — More on Gesture Recognizers

P.S. Just realized that this is more than 100 videos. I hope you enjoy it.

P.S. 2 A bit upset that there is no update for OSX in the Apple Special Event, thus hope this post brings some enjoyment to every reader.

EDIT: The new macOS App Development series has started here.

Like this post? Great, follow me on Twitter and Medium @harryworld

It will be cool if you “Recommend” this post too.

Are you parents with newborn babies? Care about your babies and want to capture their growth? You should try Moments.

--

--