iOS Development with Swift
Craig Grummitt
  • MEAP began July 2016
  • Publication in June 2017 (estimated)
  • ISBN 9781617294075
  • 550 pages (estimated)
  • printed in black & white

First, the statistics. According to Apple, there are currently 380,000 registered iOS developers and over a billion iOS devices in use worldwide. Swift, the language of iOS development, is the fastest growing programming language, and the App Store has taken in more than $8 billion in sales. If you're a developer, learning how to write iPhone and iPad apps in Swift is a safe bet for job security. And because mobile app development is a rapidly-changing field that combines programming, UI design, and a bit of showmanship, it's also a great bet for job satisfaction. Ready to get started?

iOS Development with Swift is a hands-on guide to creating apps for iPhone and iPad using the Swift language. You'll start by getting a birds-eye view of how an iOS application works and what it takes to build one. Then, you'll get a quick tour of Swift that highlights its similarities and differences compared to other C-style languages. With the basics well in hand, you'll work through progressively more challenging examples as you learn how to design iOS apps, build good layouts, handle navigation, and interact with the device's camera. Along the way, you'll deepen your knowledge of iOS and the Swift language through a series of tips, sidebars, and exercises.

Table of Contents detailed table of contents

Part 1: Introducing Xcode and Swift

1. Your first iOS Application

1.1. What is Swift?

1.2. Why Swift?

1.3. What will I learn in this book?

1.4. Exploring iOS SDK

1.5. Creating an Xcode project

1.5.1. Templates

1.5.2. Project Options

1.6. Exploring the Xcode interface

1.6.1. Toolbar area

1.6.2. Utility area

1.6.3. Navigator area

1.6.4. Editor area

1.6.5. Debug area

1.7. Editing your app’s interface

1.7.1. Storyboards and nibs

1.7.2. View Controllers and Views

1.7.3. Interface Builder

1.7.4. Object library

1.7.5. Document outline

1.7.6. Inspectors

1.8. Running your app

1.8.1. Running your app on a device

1.8.2. Running your app in the simulator

1.8.3. Running your app

1.8.4. Simulator features

1.9. Summary

2. Swift data types

2.1. Xcode Playground

2.1.1. Results sidebar

2.1.2. Automatically compiling

2.1.3. Console

2.2. Swift 101

2.2.1. Variables and constants

2.2.2. A comment on comments

2.2.3. Operators

2.2.4. Control flow

2.3. Type Safety/Type Inference

2.4. Simple Types

2.4.1. Concatenating Strings

2.4.2. Converting Numbers

2.5. Collections and Tuples

2.5.1. Arrays

2.5.2. Sets

2.5.3. Dictionaries

2.5.4. Collection Higher Order Functions

2.5.5. Tuples

2.6. Optionals

2.6.1. Declaring an optional

2.6.2. Unwrapping an optional

2.6.3. Optional chaining

2.6.4. Final comments on optionals

2.7. Summary

3. Swift objects

3.1. Classes

3.1.1. Defining a class

3.1.2. Properties

3.1.3. Initializers

3.1.4. Methods

3.1.5. Computed properties

3.1.6. Class inheritance

3.1.7. Protocols

3.2. Structures

3.2.1. Structures vs classes

3.3. Extensions

3.3.1. Extensions of your type

3.3.2. Extensions of their type

3.3.3. Operator overloading

3.3.4. Generics

3.4. Summary

Part 2: Building Your Interface

4. View Controllers, Views and Outlets

4.1. View Hierarchy

4.1.1. The Window

4.2. Model-view-controller

4.3. View Controller

4.3.1. Creating a custom view controller

4.3.2. Customizing a UIViewController subclass

4.3.3. Initial View Controller

4.3.4. View Controller Life cycle

4.3.5. Container View Controllers

4.4. Managing Views

4.4.1. Managing views in code

4.4.2. Managing views in Interface Builder

4.5. Summary

5. User Interaction

5.1. Controls

5.1.1. Button

5.1.2. Text Field

5.1.3. Other Controls

5.2. Touching views

5.2.1. Hit testing

5.2.2. Overriding touch methods

5.2.3. The responder chain

5.3. Gesture recognizers

5.3.1. Pan gesture

5.3.2. Pinch gesture

5.3.3. Rotate gesture

5.3.4. Simultaneous gesture recognizers

5.3.5. Swipe gesture in code

5.4. Summary

6. Adaptive layout

6.1. The problem

6.2. Auto layout

6.2.1. Auto layout in Interface Builder

6.2.2. Auto layout in code

6.2.3. Auto layout tips

6.3. Autoresizing

6.3.1. Autoresizing in code

6.3.2. Autoresizing in Interface Builder

6.3.3. Autoresizing considerations

6.4. Manual Adaptive layout

6.4.1. Receiving transition events

6.4.2. Receiving layout events

6.5. Choosing an approach

6.6. Summary

7. More Adaptive Layout

7.1. Size classes

7.1.1. Size classes in code

7.1.2. Size classes in Interface Builder

7.2. Stack Views

7.2.1. The problem with auto layout

7.2.2. Stack view properties

7.2.3. Simple Stack view in Interface Builder

7.2.4. Nested stack views in Interface Builder

7.2.5. Adding or removing views from a stack view

7.2.6. Stack views in code

7.3. Summary

8. Keyboard Notifications, Animations, and Scrolling

8.1. The problem with the keyboard

8.2. Dismissing the keyboard

8.2.1. Dismissing the keyboard by resigning the first responder!

8.2.2. Detecting when to dismiss the keyboard

8.3. Observing Keyboard Notifications

8.3.1. What is a notification?

8.3.2. Observing a keyboard frame change notification

8.3.3. Unregistering a notification

8.3.4. Extracting keyboard information from the notification

8.4. Animating views

8.4.1. Animating the view from under the keyboard

8.4.2. Diving deeper into animating views with a sample bar chart

8.5. Scroll Views

8.5.1. Scroll view with form content and keyboard

8.5.2. Diving deeper into scroll views with image content

8.6. Summary

Part 3: Building Your App

9. Tables and Navigation

9.1. Displaying data in table views

9.1.1. Setting up a table view controller in the storyboard

9.1.2. Displaying data in the table view

9.2. Adding a row

9.2.1. Embedding in a Navigation Controller

9.2.2. Creating a segue

9.2.3. Embedding second navigation controller

9.2.4. Communicating with the books scene using your own delegate

9.2.5. Adding the data to the table

9.3. Editing a row

9.3.1. Creating a segue from a row

9.3.2. Passing in the book object to edit

9.3.3. Removing the view controller

9.3.4. Updating the book object

9.4. Deleting a row

9.5. Summary

10. Collections, Searching, Sorting and Tab Bars

10.1. Sorting the data

10.1.1. Creating a sort method to sort the book array.

10.1.2. Changing sort order

10.2. Searching the data

10.2.1. Creating a search controller

10.2.2. Filtering the data

10.2.3. Removing and updating rows with filtered data

10.3. Displaying data in collection views

10.3.1. Creating custom collection cells

10.3.2. Displaying data in a custom collection view cell

10.3.3. Implementing a flow layout

10.3.4. Adding a search bar to the collection view

10.3.5. Implementing the flow layout delegate

10.4. Creating sections with a Tab Bar Controller

10.4.1. Sharing data between tabs

10.5. Summary

11. Data persistence

11.1. Preserving User Preferences and State

11.1.1. Preserving and Restoring State

11.1.2. Preserving User Preferences on the Device

11.2. Storing data locally

11.2.1. Storage setup

11.2.2. Structured data files

11.2.3. Archiving objects

11.2.4. SQLite

11.2.5. Core Data

11.3. Summary

12. Data persistence in iCloude

13. Graphics and Media

14. Networking, Libraries and Threads

15. Debugging

Part 4: Finalizing Your App

16. Testing

17. Distributing your App


Appendix A: Swift Syntax cheat sheets

What's inside

  • Introduction to mobile app development for iPhone and iPad
  • Adaptive designs that respond to different environments
  • Storing and managing data
  • Connecting to web services
  • Publishing to the App Store
  • Testing and debugging Swift code

About the reader

Written for readers with experience using a language like Java, Python, or C#. No prior iOS development or Swift experience required.

About the author

Craig Grummitt has been developing interactive applications for over 20 years, including touch-screen exhibits, Facebook games, online learning, and mobile apps. He's a successful online instructor and mentor, and his iOS apps have had over 50,000 downloads.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
MEAP combo $49.99 pBook + eBook
MEAP eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks