Book Image

Mastering macOS Programming.

By : Stuart Grimshaw, Gregory Casamento
Book Image

Mastering macOS Programming.

By: Stuart Grimshaw, Gregory Casamento

Overview of this book

macOS continues to lead the way in desktop operating systems, with its tight integration across the Apple ecosystem of platforms and devices. With this book, you will get an in-depth knowledge of working on macOS, enabling you to unleash the full potential of the latest version using Swift 3 to build applications. This book will help you broaden your horizons by taking your programming skills to next level. The initial chapters will show you all about the environment that surrounds a developer at the start of a project. It introduces you to the new features that Swift 3 and Xcode 8 offers and also covers the common design patterns that you need to know for planning anything more than trivial projects. You will then learn the advanced Swift programming concepts, including memory management, generics, protocol orientated and functional programming and with this knowledge you will be able to tackle the next several chapters that deal with Apple’s own Cocoa frameworks. It also covers AppKit, Foundation, and Core Data in detail which is a part of the Cocoa umbrella framework. The rest of the book will cover the challenges posed by asynchronous programming, error handling, debugging, and many other areas that are an indispensable part of producing software in a professional environment. By the end of this book, you will be well acquainted with Swift, Cocoa, and AppKit, as well as a plethora of other essential tools, and you will be ready to tackle much more complex and advanced software projects.
Table of Contents (28 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface
18
LLDB and the Command Line

Chapter 1. Hello macOS

Goodbye and thank you OS X, hello and welcome macOS!

Sierra is here, also known as macOS 10.12. Apple's latest OS release, announced at the 2016 World Wide Developers Conference, offers the modern app developer more tools than ever with which to create engaging, productive, and entertaining apps for what an ever-increasing number of people deem the world's most advanced operating system.

Now that it's here, it seems it was a long time coming. Apple has renamed its desktop operating system to reflect its integral part in the Apple ecosystem, which comprises iOS, tvOS, watchOS, and finally macOS. This makes a lot of sense, since so much of what we know both as users and as developers from one platform is reflected in the others, sometimes very closely, sometimes adapted to differences in the hardware with which these platforms are used.

The cross-fertilization of Apple's platforms is rapidly increasing, giving new impetus to the desktop operating system that has in many ways taken a back seat to the mobile juggernaut that the iPhone and iPad represent. The massive adoption of mobile technologies has provided a spurt of innovation that Apple has begun to integrate seriously into what has become macOS. At the same time, decades of experience with macOS, then OS X, and now macOS have flowed into the mobile space as the processors in phones and other devices grow more powerful.

But although the name has changed, the OS is in every sense the next version of OS X, as the 10.12 version number makes clear. Visually, nothing has changed either; About This Mac still shows the same small info window--only the mountain has changed:

This is really a great time to be an app developer. It is no exaggeration to describe what is happening across the globe as the digital revolution, and whether we're interested in productivity, entertainment, dissemination of information, or any one of scores of other development genres, we find ourselves on extremely fertile ground. It seems there are as many opportunities out there as there are souls ready to take on the challenges of creating the software that continues to drive progress at a breathtaking pace.

When approaching macOS as a developer, you will be able to make use of any and all experience you may have with programming for OS X, and if your background is in iOS and/or one of the other platforms, you will also discover the great extent to which you can leverage the knowledge and skills you have developed on those platforms. Indeed, much of the code you write for one platform will be directly usable in another, with little or no adaptation necessary.

If you are coming from a non-Apple background, I think it is safe to say you will find developing in Swift for macOS a rewarding expansion of your skills. Swift is a rich, flexible and expressive language, but not one that is hard to learn. It has, to some extent, a syntactic similarity to many modern object-oriented programming languages such as Python and Java (okay, modern in comparison to earlier popular successes such as Lisp and Fortran).

In this first chapter, we will look at the following topics:

  • The Swift programming language
  • Xcode and other development tools
  • How this book is structured
  • Some prerequisites for getting the most from this book
  • What this book will do for you once you have read it

So, let's look at where this book is going to take you, and how it will get you there.