Place your own amazing desktop apps into the hands of thousands of people through the Mac App Store
Become completely proficient in macOS app development using the latest version of Apple's programming language, Swift 4, along with best practices and techniques
Welcome to the hacking with Mac OS tutorial this series is designed to make it easy for beginners to get started coding for Mac OS using the swift programming language where directly using Paul's manual for hacking with Mac OS and his teaching skips out a lot of theory it skips out the small techniques that transform 20 lines of easy to understand code into one line of near magic. So what you get here is coding on a need to know basis. Nearly everything you learn will have a direct practical application to something we're working on. That way your brain can see exactly why a certain technique is helpful and you can start using it right away. And these tutorials and projects are crafted around a few basic tenets and it's important you understand that before continuing. First one followed the series. The tutorials are designed to be used in order starting at the beginning and working through to the end. The main reason for this is that the concepts are introduced sequentially on a need to know basis. You only learn about something when you really have to in order to make the project work. Number two don't skip the games and techniques. The tutorial follows a sequence app.. Game technique. Game technique etc.. That is you develop an app then you develop a game and then we focus on a particular Mac OS component to make your apps better. The apps and games are of course standalone projects that you can go on to develop as you wish. Whereas the technique tutorials will often be used to improve or prepare you for other projects. And number three get ready to hack. This is not designed to be a one stop learning solution for all your swift needs because the goal of each project is to reach the end with as little complication as possible where hacking or playing around with the language not trying to give you computer science 101 here and we're going to start right into coding shortly. However there are some points you need to know. Swift is a relatively new language and it's evolving quickly. Every new release of X code seems to change something or other and often means that the code that used to work now no longer does but at the time of this writing Swift is mature enough that the changes are relatively minor. So hopefully you can make them for yourself. If not go ahead and check to see if there's an update of the project files on hacking with swift dotcom. Here is a note for iOS developers. Swift apps for iOS and Mac OS have many things in common but just as many things that set them apart do out this tutorial you'll find tips and warnings for iOS developers that help provide a little extra context and I hope helps smooth the learning curve. If you're coming from Iowa as the swift language is of course identical on both platforms but naturally things run faster on Mac OS because you're working with more power 8 gigabytes or even 16 gigabytes of RAM as common as our quad core C-p use. IOS was based on Mac OS when it was first created but the two have diverged dramatically since then. As a development platform iOS has had far more success than Mac OS and so is seen substantially more development over the years. Lots of UI things have an equivalence UI button has an s button UI table view has an S table view you segmented control has an s segmented control and so on. They are not identical however so I'll be pointing out differences. As we progress in some things you take for granted on iOS such as every view having an adjustable background color does not exist on Mac OS. Remember when Mac OS was created as OS X back in 2001. Things like Core Animation didn't exist so viewers didn't have a layer of property. More recently Apple has started enabling Core Animation layers by default but this will still trip you up in some places and we'll work through that as we get to it. So as a result of Core Animation the late introduction into Mac OS animation is significantly less seamless on Mac OS than it is on iOS and on iOS. We have UI window but it's mostly invisible on Mac OS and X-Window is important because an app can have multiple windows each of which can have their own size that users can change at will. The ability to resize windows on the fly means Mac OS has no concept of auto resizing table view cells because they are computationally expensive and OSX. Now Mac OS has gone through multiple major versions since its release including various changing user interface designs and has much less of a standard look and feel than I Os. That is X code. ITunes keynote and Safari all look completely different. They all use the same basic tool kit but use different button styles label styles and so on and some objects that were host in iOS are separate entities in Mac OS the best example of this is you white text view which is a single object in Iowa that includes a scroll of view on Mac OS. If you drop in any text view into interface builder you'll get an ad scroll view that contains an NSA clip view which in turn contains an enhanced text view the scroll view handles scrolling the clip view ensures hidden things don't get shown in a text view handles the editing. And number nine here on our list of things that you need to know if you're coming from Iowa this is cocoa is extremely focused on object orientation and frequently the only way to adjust the setting is to create a subclass. So I've made this clear along the way and first responder exists on iOS but it's rarely used on Mac OS that takes a much greater role and is responsible for determining things like what code should be run when a menu bar item is chosen and Mac OS buttons come in a variety of forms and you might feel a bit overwhelmed at first. Conversely the parallel view I label is an ass textfield just with editing turned off and the y axis starts at the bottom of the screen in Mac OS whereas it's the top of the screen in Iowa. So this means everything feels fliped when you move to Mac OS. It's a bit like visiting a country where they drive on the other side of the road. And finally it's more complicated because it needs to do more than. Things like drag and drop are hard and a basic requirement on Mac OS and Next up we'll talk a little bit about. The main development framework behind Mac OS.