O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

iOS 10 Programming for Beginners

Book Description

Begin your iOS mobile application development journey with this accessible, practical guide

About This Book

  • Use Swift 3 and latest iOS 10 features to build awesome apps for iPhone and iPad
  • Explore and use a wide range of Apple development tools to become a confident iOS developer
  • From prototype to App Store—find out how to build an app from start to finish!

Who This Book Is For

This book is for beginners who want to be able to create iOS applications. If you have some programming experience, this book is a great way to get a full understanding of how to create an iOS application from scratch and submit it to the App Store. You do not need any knowledge of Swift or any prior programming experience.

What You Will Learn

  • Get to grips with Swift 3 and Xcode, the building blocks of Apple development
  • Get to know the fundamentals of Swift, including variables, constants, and control flow
  • Discover the distinctive design principles that define the iOS user experience
  • See how to prototype your app with Swift’s Playgrounds feature
  • Build a responsive UI that looks great on a range of devices
  • Find out how to use CoreLocation to add location services to your app
  • Add push notifications to your app
  • Make your app able to be used on both iPhone and iPad

In Detail

You want to build iOS applications for iPhone and iPad—but where do you start? Forget sifting through tutorials and blog posts, this is a direct route into iOS development, taking you through the basics and showing you how to put the principles into practice. With every update, iOS has become more and more developer-friendly, so take advantage of it and begin building applications that might just take the App Store by storm!

Whether you’re an experienced programmer or a complete novice, this book guides you through every facet of iOS development. From Xcode and Swift—the building blocks of modern Apple development—and Playgrounds for beginners, one of the most popular features of the iOS development experience, you’ll quickly gain a solid foundation to begin venturing deeper into your development journey. For the experienced programmer, jump right in and learn the latest iOS 10 features.

You’ll also learn the core elements of iOS design, from tables to tab bars, as well as more advanced topics such as gestures and animations that can give your app the edge. Find out how to manage databases, as well as integrating standard elements such as photos, GPS into your app. With further guidance on beta testing with TestFlight, you’ll quickly learn everything you need to get your project on the App Store!

Style and approach

Created for anyone that wants to build their first iOS application, this book offers practical, actionable guidance through iOS development. Combining engaging visuals with accessible, step-by-step instructiona and explanation, this book will not only develop the your understanding, but also show you how to put your knowledge to work.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. iOS 10 Programming for Beginners
    1. Table of Contents
    2. iOS 10 Programming for Beginners
    3. Credits
    4. About the Author
    5. About the Reviewer
    6. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    7. Customer Feedback
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading theexample code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    9. 1. Getting Familiar with Xcode
      1. Getting started
      2. The Xcode interface
        1. Navigator panel
        2. Standard editor
        3. Utilities panel
        4. Debug panel
        5. Toolbar
        6. Generic iOS Device
        7. iOS device
        8. Window Pane Controls
      3. Summary
    10. 2. Building a Foundation with Swift
      1. Playgrounds – an interactive coding environment
      2. Data types – where it all starts
        1. String
        2. Integer data type
        3. Floating-point numbers
        4. Booleans
        5. Variables and constants – where data is held
          1. Creating a variable with a String
          2. Creating a variable with an Integer (Int)
          3. Debug and print() – detecting your bugs
          4. Adding floating-point numbers
          5. Creating a Boolean
          6. Hungarian notation
          7. Why constants versus variables?
      3. Comments – leaving yourself notes or reminders
      4. Type safety and type inference
        1. Concatenating strings
        2. String interpolation
      5. Operations with our Integers
        1. Increment and decrement
        2. Comparison operators
        3. If-Statements – having fun with logic statements
      6. Optionals and Optional Bindings
        1. Why optionals?
      7. Functions
      8. Let's Work
      9. Summary
    11. 3. Digging Deeper
      1. Creating a Playground project
      2. Ranges
        1. Closed Range
        2. Half closed Range
      3. Control flow
        1. The for…in loop
        2. The while loop
        3. The repeat…while loop
      4. Summary
    12. 4. Digging into Collections
      1. Arrays
        1. Creating an empty array
        2. Creating an array with initial values
        3. Creating a mutable array
        4. Adding items to an array
        5. Checking the number of elements in an array
        6. Checking for an empty array
        7. Retrieving a value from an array
        8. Iterating over an array
        9. Removing items from an array
      2. Dictionaries
        1. Creating a dictionary
        2. Adding and updating dictionary elements
        3. Accessing an item in a dictionary
        4. Iterating over dictionary values
        5. Iterating over dictionary keys
        6. Iterating over dictionary keys and values
        7. Checking the number of items in a dictionary
        8. Removing Items from a dictionary
      3. Sets
        1. Creating an empty set
        2. Creating a set with an array literal
        3. Creating a mutable set
        4. Adding items into a set
        5. Checking if a set contains an item
        6. Iterating over a set
        7. Intersecting two sets
        8. Joining two sets
        9. Removing items from a Set
      4. Summary
    13. 5. Starting the UI Setup
      1. Useful terms
        1. View Controller
        2. Table View Controller
        3. Collection View Controller
        4. Navigation Controller
        5. Tab Bar Controller
        6. Storyboard
        7. Segue
        8. Auto layout
        9. Model View Controller (MVC)
          1. App Tour
        10. Explore tab
        11. Locations
        12. Restaurant listings
        13. Restaurant detail
        14. Map tab
      2. Project setup
        1. Creating a new project
        2. Creating our files
        3. Storyboard setup
          1. Adding our App assets
      3. Storyboards
        1. Creating our launch screen
        2. Adding a Navigation Controller
      4. Creating a custom title view
        1. Adding a container
        2. Using Stack Views
        3. Adding a Custom Label and an Arrow to Our Custom Title View
      5. Summary
    14. 6. Setting Up UI
      1. Design clean up
        1. Adding a Clear Background to the Custom Title View
        2. Updating the UIStackView
        3. Updating our Arrow
        4. Updating our Label
        5. Adding a Button
          1. Collection View
        6. Adding a Modal
        7. Map Kit View
        8. Fixing the Crash
      2. Refactoring the Storyboard
        1. Creating a New Storyboard for the Explore Tab
        2. Creating a New Storyboard for the Map Tab
        3. Folder Setup
        4. Organizing folders
        5. Setting up Global Settings
          1. Breaking Down our App Delegate
      3. Summary
    15. 7. Getting Started with the Grid
      1. Understanding the Model View Controller architecture
        1. Model
        2. View
        3. Controller
      2. Getting familiar with the setup
        1. Classes and Structures
        2. Controllers and Classes
        3. Creating our Controller
          1. Understanding Collection View Controllers and Collection View Cells
        4. Getting Data into Collection View
        5. Understanding the Data Source
          1. Updating the Grid
        6. Model
          1. ExploreData.plist
          2. ExploreItem.swift
          3. ExploreDataManager.Swift
          4. Getting Data
        7. CollectionView Cell
        8. Connecting to Our Cell
        9. Hooking up Our UI with IBOutlets
          1. Cell Selection
      3. Restaurant Listing
      4. Summary
    16. 8. Getting Started with the List
      1. Updating UI in Storyboard
        1. Updating Bar Button Items
        2. Unwinding our cancel button
      2. Adding Our First Table View
        1. Updating Our Edges
        2. Creating Our View Controller Class
        3. Connecting our TableView with our Location View Controller
        4. Adding the Data Source and Delegate
        5. Creating a Prototype Cell
        6. Digging into Our Table View code
        7. Adding Locations to Our Table View
      3. Creating Our First Property List (plist)
        1. Adding Data to Our Property List
        2. Creating Our Location Data Manager
        3. Working with Our Data Manager
      4. Summary
    17. 9. Working More with Lists
      1. Creating our Restaurant detail
      2. Setting up our static Table View
        1. Exploring Restaurant details
        2. Creating our section headers
        3. Adding our labels
      3. Address section
      4. Creating Reviews
      5. Reservations
        1. Adding reservation times
        2. Reservation information
        3. Reservation header
      6. Summary
    18. 10. Where Are We?
      1. Setting up map annotations
        1. What is an MKAnnotation?
          1. Creating a restaurant annotation
      2. Creating our Map Data Manager
        1. Creating a base class
        2. Refactoring ExploreDataManager
      3. Creating and adding annotations
        1. Creating our Map View Controller
        2. Creating custom annotations
      4. Refactoring restaurant detail
        1. Creating a Storyboard reference
        2. Map to restaurant detail
        3. Passing data to Restaurant detail
      5. Organizing your code
      6. Summary
    19. 11. Where's My Data?
      1. Creating an API Manager
        1. What is an API?
        2. Understanding a JSON file
        3. Exploring the API Manager file
      2. Location list
        1. Selecting a location
        2. Passing a selected location back to Explore View
      3. Getting the last selected location
        1. Passing location and cuisine to the restaurant list
      4. Building our restaurant list
        1. Updating our background
        2. Updating our restaurant list cell
        3. Positioning elements in our restaurant list cell
        4. Adding auto layout to our restaurant list cell
        5. Creating our restaurant cell class
      5. Setting up restaurant list cell outlets
        1. Creating RestaurantDataManager
        2. Displaying data in Restaurant list cell
      6. Restaurant details
        1. Displaying data in the Restaurant Detail view
        2. Passing data to our Restaurant List View Controller
      7. Map update
      8. Challenge yourself
      9. Summary
    20. 12. Foodie Reviews
      1. Getting started with reviews
        1. Setting up our table view controllers
      2. Creating reviews
        1. Setting up the Review Storyboard
        2. Updating the Review Cells
        3. Positioning UI elements
        4. Adding Auto Layout for creating reviews
        5. Adding Ratings View
        6. Adding Auto Layout for Ratings View
        7. Adding our Photo Filter View
        8. Adding Auto Layout for the Photo Filter View
        9. Presenting our Views as Modals
        10. Setting up our unwind segues
        11. Hooking up our unwind segues
      3. Working with filters
        1. Creating our Filter Scroller
        2. Creating our apply Filter View Controller
        3. Creating review images
      4. Summary
    21. 13. Saving Reviews
      1. What is Core Data?
        1. NSManagedObjectModel
        2. NSManagedObjectContext
        3. NSPersistentStoreCoordinator
      2. Creating a data model
        1. Entity auto-generation
        2. Review item
        3. Core Data Manager
      3. Creating star ratings
        1. Setting up the cell UI
        2. Adding Auto Layout
        3. Adding Review List extension
      4. Summary
    22. 14. Universal
      1. Explore
      2. Restaurant listing
      3. Updating restaurant details
        1. Updating the header layout
        2. Updating the table details section layout
        3. Updating the No Reviews Layout
        4. Updating the Reviews layout
        5. Updating the Map section layout
      4. Summary
    23. 15. iMessages
      1. Understanding iMessages
        1. Creating our extension
        2. Updating our assets
        3. Implementing our Messages UI
        4. Adding Auto Layout to our cell
      2. Creating a framework
        1. Connecting our message cell
        2. Showing restaurants
        3. Sending reservations
      3. Summary
    24. 16. Notifications
      1. Starting with the basics
        1. Getting permission
        2. Setting up notifications
        3. Showing notifications
      2. Customizing our notifications
        1. Embedding images
        2. Adding buttons
      3. Custom UI in notifications
      4. Summary
    25. 17. Just a Peek
      1. Adding 3D Touch quick actions
      2. Adding favorites
        1. Creating a new model object
        2. Updating our Core Data manager
      3. Summary
    26. 18. Beta and Store Submission
      1. Creating a bundle identifier
      2. Creating a Certificate Signing Request
      3. Creating production and development certificates
      4. Creating a Production Provisioning Profile
      5. Creating a Development Provisioning Profile
      6. Creating the App Store Listing
      7. Creating an archive build
      8. Internal and External Testing
        1. Internal testing
        2. External testing
      9. Summary
    27. Index