0%

Book Description

A step-by-step guide to learning iOS app development and exploring the latest Apple development tools

Key Features

  • Explore the latest features of Xcode 11 and the Swift 5 programming language in this updated fourth edition
  • Kick-start your iOS programming career and have fun building your own iOS apps
  • Discover the new features of iOS 13 such as Dark Mode, iPad apps for Mac, SwiftUI, and more

Book Description

iOS 13 comes with features ranging from Dark Mode and Catalyst through to SwiftUI and Sign In with Apple. If you're a beginner and are looking to experiment and work with these features to create your own apps, then this updated fourth edition gets you off to a strong start. The book offers a comprehensive introduction for programmers who are new to iOS, covering the entire process of learning the Swift language, writing your own apps, and publishing them on the App Store. This edition is updated and revised to cover the new iOS 13 features along with Xcode 11 and Swift 5.

The book starts with an introduction to the Swift programming language, and how to accomplish common programming tasks with it. You'll then start building the user interface (UI) of a complete real-world app, using the latest version of Xcode, and also implement the code for views, view controllers, data managers, and other aspects of mobile apps. The book will then help you apply the latest iOS 13 features to existing apps, along with introducing you to SwiftUI, a new way to design UIs. Finally, the book will take you through setting up testers for your app, and what you need to do to publish your app on the App Store.

By the end of this book, you'll be well versed with how to write and publish apps, and will be able to apply the skills you've gained to enhance your apps.

What you will learn

  • Get to grips with the fundamentals of Xcode 11 and Swift 5, the building blocks of iOS development
  • Understand how to prototype an app using storyboards
  • Discover the Model-View-Controller design pattern, and how to implement the desired functionality within the app
  • Implement the latest iOS features such as Dark Mode and Sign In with Apple
  • Understand how to convert an existing iPad app into a Mac app
  • Design, deploy, and test your iOS applications with industry patterns and practices

Who this book is for

This book is for anyone who has programming experience but is completely new to Swift and iOS app development. Experienced programmers looking to explore the latest iOS 13 features will also find this book useful.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. iOS 13 Programming for Beginners Fourth Edition
  3. About Packt
    1. Why subscribe?
  4. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Code in Action
      4. Conventions used
    4. Get in touch
      1. Reviews
  6. Section 1: Swift
  7. Getting Familiar with Xcode
    1. Technical requirements
    2. Downloading and installing Xcode from the App Store
    3. Understanding the Xcode user interface
    4. Running the app in the Simulator
      1. Understanding the No Device and Build Only Device menu items
    5. Using an iOS 13 device for development
      1. Trusting the Developer App certificate on your iOS device
      2. Connecting an iOS device wirelessly
    6. Summary
  8. Simple Values and Types
    1. Technical requirements
    2. Understanding Swift playgrounds
      1. Customizing fonts and colors
    3. Exploring data types
      1. Storing integers
      2. Storing floating-point numbers
      3. Storing Booleans
      4. Storing strings
      5. Using common data types in the playground
    4. Exploring constants and variables
    5. Understanding type inference and type safety
      1. Using type annotation to specify a type
      2. Type safety
    6. Exploring operators
      1. Using arithmetic operators
      2. Using compound assignment operators
      3. Using comparison operators
      4. Using logical operators
      5. Performing string operations
    7. Using the print() instruction
    8. Summary
  9. Conditionals and Optionals
    1. Technical requirements
    2. Introducing conditionals
      1. Using if statements
      2. Using switch statements
    3. Introducing optionals
      1. Using optionals and optional binding
    4. Summary
  10. Range Operators and Loops
    1. Technical requirements
    2. Range operators
    3. Loops
      1. The for-in loop
      2. The while loop
      3. The repeat-while loop
    4. Summary
  11. Collection Types
    1. Technical requirements
    2. Understanding arrays
      1. Creating an array
      2. Checking the number of elements in an array
      3. Adding a new item to an array
      4. Accessing an array element
      5. Assigning a new value to an index
      6. Removing an item from an array
      7. Iterating over an array
    3. Understanding dictionaries
      1. Creating a dictionary
      2. Checking the number of elements in a dictionary
      3. Adding a new item to a dictionary
      4. Accessing a dictionary element
      5. Assigning a new value to a key
      6. Removing an item from a dictionary
      7. Iterating over a dictionary
    4. Understanding sets
      1. Creating a set
      2. Checking the number of elements in a set
      3. Adding a new item to a set
      4. Checking whether a set contains an item
      5. Removing an item from a set
      6. Iterating over a set
      7. Set operations
      8. Set membership and equality
    5. Summary
  12. Functions and Closures
    1. Technical requirements
    2. Understanding functions
      1. Creating a function
      2. Using custom argument labels
      3. Using nested functions
      4. Using functions as return types
      5. Using functions as parameters
      6. Using a guard statement to exit a function early
    3. Understanding closures
      1. Simplifying closures
    4. Summary
  13. Classes, Structures, and Enumerations
    1. Technical requirements
    2. Understanding classes
      1. Creating a class declaration
      2. Making an instance of the class
      3. Making a subclass
      4. Overriding a superclass method
    3. Understanding structures
      1. Creating a structure declaration
      2. Making an instance of the struct
      3. Value types versus references types
      4. Deciding which to use
    4. Understanding enumerations
      1. Creating an enumeration
    5. Summary
  14. Protocols, Extensions, and Error Handling
    1. Technical requirements
    2. Understanding protocols
      1. Creating a protocol declaration
    3. Understanding extensions
      1. Adopting a protocol via an extension
      2. Creating an array of different types of objects
    4. Exploring error handling
    5. Summary
  15. Section 2: Design
  16. Setting Up the Basic Structure
    1. Technical requirements
    2. Useful terms
    3. Touring the Let's Eat app
      1. Using the Explore screen
      2. Using the Locations screen
      3. Using the Restaurant List screen
      4. Using the Restaurant Detail screen
      5. Using the Review Form screen
      6. Using the Map screen
    4. Creating a new Xcode project
    5. Setting up a Tab Bar Controller Scene and Launch screen 
      1. Setting the titles of the Tab Bar's buttons 
      2. Embedding view controllers in navigation controllers
      3. Adding the Assets.xcassets file
      4. Configuring the Launch screen's background color
      5. Adding a logo and constraints to the Launch screen
      6. Adding the icons for the Explore and Map buttons
    6. Summary
  17. Building Your App Structure in Storyboard
    1. Technical requirements
    2. Adding a collection view to the Explore screen
      1. Adding a Cocoa Touch Class file to your project
    3. Connecting outlets in storyboard to the view controller
    4. Configuring data source methods for the collection view
      1. Setting the delegate and data source properties of the collection view
      2. Adopting the UICollectionViewDataSource and UICollectionViewDelegate protocols
    5. Adding a section header to the collection view
    6. Creating a custom color
    7. Configuring the collection view cell and section header size
    8. Presenting a view modally
      1. Adding a button to the collection view header
      2. Adding a new view controller scene
      3. Adding the Cancel and Done buttons to the navigation bar
    9. Summary
  18. Finishing Up Your App Structure in Storyboard
    1. Technical requirements
    2. Adding a table view to the Locations screen
    3. Implementing the Restaurant List screen
      1. Declaring the RestaurantListViewController class
      2. Adopting the delegate and data source protocols
      3. Presenting the Restaurant List screen
    4. Implementing the Restaurant Detail screen
    5. Implementing the Review Form screen
    6. Implementing the Map screen
    7. Summary
  19. Modifying and Configuring Cells
    1. Technical requirements
    2. Modifying the Explore screen section header
      1. Adding Auto Layout to the Explore screen's section header
    3. Modifying the exploreCell collection view cell
    4. Modifying the restaurantCell collection view cell
      1. Adding Auto Layout constraints to the restaurantCell collection view cell
    5. Configuring the locationCell table view cell
    6. Summary
  20. Section 3: Code
  21. Getting Started with MVC and Collection Views
    1. Technical requirements
    2. Understanding the MVC design pattern
    3. Exploring controllers and classes
      1. Understanding collection views
      2. Revisiting the Explore and Restaurant List screens
    4. Summary
  22. Getting Data into Collection Views
    1. Technical requirements
    2. Understanding model objects
      1. Understanding .plist files
      2. Creating a structure to represent a cuisine
      3. Implementing a data manager class to read data from a .plist
      4. Using the data manager to initialize ExploreItem instances
    3. Displaying data in a collection view
      1. Connecting the outlets in exploreCell
      2. Implementing additional data manager methods
      3. Updating the data source methods in ExploreViewController
    4. Summary
  23. Getting Started with Table Views
    1. Technical requirements
    2. Understanding table views
    3. Creating LocationViewController
      1. Connecting the table view to LocationViewController
      2. Adding the data source and delegate methods
    4. Adding location data for the table view
      1. Creating a property list (.plist) file
      2. Adding data to the .plist file
    5. Creating LocationDataManager
      1. Displaying data in a table view using LocationDataManager
    6. Cleaning up the user interface
    7. Summary
  24. Getting Started with MapKit
    1. Technical requirements
    2. Understanding and creating annotations
      1. Introducing MKAnnotation
      2. Creating the RestaurantItem class
      3. Creating MapDataManager
      4. Creating the DataManager protocol
      5. Refactoring MapDataManager
      6. Refactoring ExploreDataManager
    3. Adding annotations to a map view
      1. Creating MapViewController
      2. Connecting the outlets for the map view to MapViewController
      3. Setting the map view region to be displayed
      4. Displaying annotations on the map view
      5. Creating custom annotations
    4. Going from the Map screen to the Restaurant Detail screen 
      1. Creating and configuring a storyboard reference
      2. Performing the showDetail segue
      3. Passing data to the Restaurant Detail screen
    5. Organizing your code
      1. Refactoring ExploreViewController
      2. Using the // MARK: syntax
      3. Refactoring RestaurantListViewController
      4. Refactoring LocationViewController
      5. Refactoring MapViewController
    6. Summary
  25. Getting Started with JSON Files
    1. Technical requirements
    2. Getting data from JSON files
      1. What is an API?
      2. Understanding the JSON format
      3. Creating RestaurantAPIManager
    3. Using data from JSON files in your app
      1. Storing a user-selected location in LocationViewController
      2. Adding a view controller for the section header in the Explore screen
      3. Connecting the section header's label to ExploreViewController
      4. Adding an unwind action method to the Done button
      5. Selecting only one location in the Location screen
      6. Passing location and cuisine information to RestaurantListViewController
      7. Creating a view controller for the cells on the Restaurant List screen
      8. Connecting the outlets for RestaurantCell
      9. Creating RestaurantDataManager
      10. Configuring MapDataManager to use RestaurantDataManager
      11. Displaying a custom UIView to indicate no data available
      12. Displaying a list of restaurants on the Restaurant List screen
    4. Summary
  26. Displaying Data in a Static Table View
    1. Technical requirements
    2. Setting up outlets for RestaurantDetailViewController
    3. Displaying data in the static table view
    4. Passing data from RestaurantListViewController to RestaurantDetailViewController
    5. Summary
  27. Getting Started with Custom UIControls
    1. Technical requirements
    2. Creating a custom UIControl object
    3. Displaying stars in your custom UIControl object
    4. Adding support for touch events
    5. Implementing an unwind method for the Cancel button
    6. Creating ReviewFormViewController
    7. Summary
  28. Getting Started with Cameras and Photo Libraries
    1. Technical requirements
    2. Understanding filters
    3. Creating a scrolling list of filters
      1. Creating a view controller for the filter cell
      2. Creating a View Controller for the Photo Filter screen
    4. Getting permission to use the camera or photo library
    5. Summary
  29. Understanding Core Data
    1. Technical requirements
    2. Introducing Core Data
    3. Implementing Core Data components for your app
      1. Creating a data model
      2. Creating ReviewItem
      3. Creating RestaurantPhotoItem
      4. Creating a Core Data manager
    4. Creating ReviewDataManager
    5. Summary
  30. Saving and Loading from Core Data
    1. Technical requirements
    2. Understanding how saving and loading works
      1. Adding a restaurantID property to RestaurantItem
    3. Updating ReviewFormViewController to save reviews
      1. Passing RestaurantID to ReviewFormViewController
    4. Updating PhotoFilterViewController to save photos
    5. Displaying saved reviews and photos on the Restaurant Detail screen
    6. Calculating a restaurant's overall rating
    7. Summary
  31. Section 4: Features
  32. Getting Started with Dark Mode
    1. Technical requirements
    2. Turning on Dark Mode in the simulator
    3. Updating the Launch screen to work with Dark Mode
    4. Updating the Explore screen to work with Dark Mode
    5. Updating the Restaurant List screen to work with Dark Mode
    6. Updating the Restaurant Detail screen to work with Dark Mode
      1. Updating the Reviews View Controller scene and NoDataView to work with Dark Mode
      2. Updating the Photo Reviews View Controller Scene to work with Dark Mode
    7. Summary
  33. Getting Started with Mac Catalyst
    1. Technical requirements
    2. Cleaning up the design
    3. Updating the app to work on iPad
      1. Checking device type
      2. Updating ExploreViewController for iPad
      3. Updating RestaurantListViewController for iPad
      4. Updating the Restaurant Detail screen for iPad
    4. Updating the app to work on macOS
    5. Summary
  34. Getting Started with SwiftUI
    1. Technical requirements
    2. Creating a SwiftUI project
    3. Working with text
    4. Combining Views using Stacks
    5. Working with images
    6. Using UIKit and SwiftUI Views together
    7. Composing the Restaurant Detail screen
    8. Summary
  35. Getting Started with Sign In with Apple
    1. Technical requirements
    2. Adding a login screen
    3. Displaying a Sign in with Apple button
    4. Implementing delegate methods and button actions
    5. Passing user information to ExploreViewController
    6. Summary
  36. Testing and Submitting Your App to the App Store
    1. Technical requirements
    2. Getting an Apple Developer account
    3. Generating a certificate signing request
    4. Creating development and distribution certificates
    5. Registering an App ID
    6. Registering your devices
    7. Creating provisioning profiles
    8. Creating icons for your app
    9. Creating screenshots for your app
    10. Creating an App Store listing
    11. Creating an archive build
    12. Completing the information in App Store Connect
    13. Testing your app
      1. Testing your app internally
      2. Testing your app externally
    14. Summary
  37. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
18.119.125.94