This book is solely focused on Swift 4 and does not cover the use of Objective-C. We might mention it occasionally, but we dont expect you to know how to use it. We first cover the basics of the Swift 4 language, and then move on to teach as much of the language as we can, as well as the use of Cocoa Touch, through the construction of Selfiegram, a photo-taking app for iOS.
This books approach differs from that of other programming books that you may have encountered. As weve mentioned, we believe that the best way to learn Swift is to build something using it. We assume that youre a reasonably capable programmer, but we dont assume youve ever developed for iOS or used Swift or Objective-C before. We also assume that youre fairly comfortable navigating macOS and iOS as a user.
Organization of This Book
In this book, well be talking about Cocoa Touch, theframework used for developing iOS applications. Along the way, well alsobe covering Swift, including its syntax and features.
In , we begin with a look at the tools used for programming with Swift, as well as the Apple Developer Program. Then we move on to the basics of the Swift programming language and structuring a program for Apples platforms, as well as common design patterns.
In , we start building Selfiegram, the iOS photo-taking application thats the focus of the book. In this part, well build the foundational features, like the ability to take photos and store them on disk.
In , we add a number of particularly interesting features, including a custom camera view, face detection, network access, and theming the app.
In , we discuss a number of features and tools that can help you in your further development work, including Xcodes debugging and profiling tools, as well as third-party tools that can make your life easier.
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, andfile extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Also used for commands and command-line output.
Tip
This element signifies a tip or suggestion.
Note
This element signifies a general note.
Caution
This element indicates a warning or caution.
Using Code Examples
Supplemental material (code examples, exercises, errata, etc.) is availablefor download at our website.
This book is here to help you get your job done. In general, ifexample code is offered with this book, you may use it in your programsand documentation. You do not need to contact us for permission unlessyoure reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.
We appreciate, but do not require, attribution. An attributionusually includes the title, author, publisher, and ISBN. For example:Learning Swift, 3rd Edition, by Jonathon Manning,Paris Buttfield-Addison, and Tim Nugent (OReilly). Copyright 2018Secret Lab, 978-1-491-98757-5.
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .
OReilly Safari
Note
Safari (formerly Safari Books Online) is a membership-based training and reference platform for enterprise, government, educators, and individuals.
Members have access to thousands of books, training videos, Learning Paths, interactive tutorials, and curated playlists from over 250 publishers, including OReilly Media, Harvard Business Review, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Adobe, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, and Course Technology, among others.