Skip to main content
main-content
Top

About this book

Learn how to integrate all the interface elements iOS users have come to know and love, such as buttons, switches, pickers, toolbars, and sliders. In this edition of the best selling book, you’ll also learn about touch gestures, table views, and collection views for displaying data on a user interface.

Assuming little or no working knowledge of the Swift programming language, and written in a friendly, easy-to-follow style, this book offers a comprehensive course in iPhone and iPad programming. The book starts with a gentle introduction to using Xcode and then guides you though the creation of your first simple application.

You’ll start with designing basic user interfaces and then explore more sophisticated ones that involve multiple screens such as navigation controllers, tab bars, tool bars, page views, and split views that are particularly useful on the larger screens of the iPad and certain iPhone models. And there’s much more!

Beginning iPhone Development with Swift 5 covers the basic information you need to get up and running quickly to turn your great ideas into working iOS apps. Once you’re ready, move on to Pro iPhone Development with Swift 5 to learn more of the really unique aspects of iOS programming and the Swift language.

What You Will Learn

Discover what data persistence is, and why it’s importantBuild cool, crisp user interfacesDisplay data in Table ViewsWork with all the most commonly used iOS Frameworks

Who This Book is For

Aspiring iOS app developers new to the Apple Swift programming language and/or the iOS SDK.

Table of Contents

Chapter 1. Understanding iOS Programming

Abstract
All programming involves the same task of writing commands for a computer to follow. To learn iOS programming, you need to learn three different skills:
Wallace Wang

Chapter 2. Designing User Interfaces

Abstract
Every app needs a user interface. Unlike user interfaces for desktop operating systems like Windows or macOS that can display multiple windows on a screen at a time, iOS apps typically display a single window (called a view) that fills the entire screen at a time. Also unlike Windows or macOS user interfaces that users can manipulate using a keyboard or a mouse, users must be able to manipulate iOS apps solely through a touch screen although they can also be controlled through an optional keyboard as well. In iOS apps, a user interface consists of
Wallace Wang

Chapter 3. Writing Swift Code

Abstract
Every iOS app needs a user interface, but that user interface won’t do anything until you write Swift code to make it work. While you could write all your code in a single file, it’s better to divide your code into files where each file contains related code. A simple app might only contain a handful of files, but a more complicated app could contain dozens or even hundreds of separate files that contain related Swift code. Within each file, you can further organize your Swift code into separate functions.
Wallace Wang

Chapter 4. Using Xcode

Abstract
Before you start writing Swift code and designing user interfaces, take a moment to get acquainted with Xcode, Apple’s free tool for creating apps. Xcode offers so many features because it’s designed to handle all your needs in creating an app from start to finish. Fortunately, you won’t have to learn every single feature of Xcode to start creating apps. Instead, you can just focus on learning only the features you need and gradually learn any additional features of Xcode later. Xcode provides the following features to help you create apps for all of Apple’s products:
Wallace Wang

Chapter 5. Working with Controllers

Abstract
There’s a saying that you don’t get a second chance to make a first impression. In the world of app development, that first impression always comes through your app’s user interface. It doesn’t matter how useful, fun, and creative your app might be if the user interface is sloppy, poorly designed, or confusing. If users don’t like your app’s user interface, nothing else will really matter.
Wallace Wang

Chapter 6. Adding User Interface Objects

Abstract
Controllers contain the user interface that appears on an iOS screen. At the simplest level, a controller can contain a view, which represents an iOS screen. By default, this view is blank, so to make it display information or provide interaction to the user, you can add a variety of user interface objects such as buttons, text fields, labels, or sliders.
Wallace Wang

Chapter 7. Using Common User Interface Objects

Abstract
A user interface must display information to the user. In addition, a user interface must also allow the user to input data such as text or numbers. Finally, a user interface must allow the user to control the app. Displaying data, accepting data, and accepting commands form the heart of any user interface.
Wallace Wang

Chapter 8. Steppers, Sliders, Progress Views, and Activity Indicator Views

Abstract
Labels, text fields, and buttons are the three most common types of user interface objects, but they aren’t the only ones used to display information, allow input, and allow interaction from the user. Four other user interface objects that can display information, allow input, and allow interaction in different ways include
Wallace Wang

Chapter 9. Image Views and Text Views

Abstract
Text fields can display text and let users edit or input new text. However if you need to display large amounts of text, a text field can be too limiting. To overcome the limited size of a text field, you can use a text view instead. A text view is essentially a larger version of a text field that can display large amounts of text or allow users to edit and input large amounts of text.
Wallace Wang

Chapter 10. Buttons, Switches, and Segmented Controls

Abstract
Besides displaying data or letting users input data, the second most important purpose of a user interface is to allow users to control an app. At the simplest level, users can use buttons where each button represents a single command. Of course if you want to display multiple options, displaying multiple buttons on the screen can get crowded.
Wallace Wang

Chapter 11. Touch Gestures

Abstract
Allowing the user to control an app through buttons, switches, or segmented controls is handy, but all of these controls take up space on the screen. To eliminate the need for extra objects on the user interface, your app can also detect and respond to touch gestures that allow direct manipulation of items displayed on the screen.
Wallace Wang

Chapter 12. Using Alerts and Pickers

Abstract
Almost every app needs to display and accept data from the user. The simplest way to display data is through a label, but sometimes you need to display data and give the user a way to respond. In that case, you need to use an alert controller.
Wallace Wang

Chapter 13. Constraints and Stack Views

Abstract
Since the iPhone and iPad come in different screen sizes, every iOS app needs to adapt to these different screen sizes depending on the type of iOS device it’s running on. To define the position and spacing of different user interface objects, you can use constraints.
Wallace Wang

Chapter 14. Using Table Views

Abstract
Table views are one of the most common user interface objects for displaying large amounts of information in a list of rows. The Mail and Photos apps use table views to let users scroll through information. Table views appear to create an endless list because the moment the user scrolls up or down, new data constantly appears to take its place. Table views consist of cells that contain one or more objects such as labels or image views as shown in Figure 14-1.
Wallace Wang

Chapter 15. Customizing Table View Cells

Abstract
Chapter 14 explained how to create different types of table views including plain and grouped tables along with sections indexes. So far, we’ve only used a simple cell that displays a single line of text. In this chapter you’ll learn how to customize a cell to display additional text and images. In addition, you’ll also learn how to modify the appearance of cells.
Wallace Wang

Chapter 16. Using Collection Views

Abstract
Table views are great for displaying large amounts of data in rows that the user can scroll through. While table views are perfect for the smaller, narrower screen of the iPhone, they are limited to scrolling rows of data up and down. If you want to scroll data horizontally or display multiple columns of data, you can use a collection view instead.
Wallace Wang

Chapter 17. Using the Navigation Controller

Abstract
Only the simplest apps consist of a single view such as the Calculator app. Most apps usually need two or more views to display information. While you could create buttons and link them to different views, this can be a clumsy solution. A far better solution is to organize related views together.
Wallace Wang

Chapter 18. Using Tab Bars and Tool Bars

Abstract
Like a Navigation Controller, a Tab Bar Controller also groups related view controllers together. The main difference is that a Navigation Controller can only display view controllers in sequential order. On the other hand, a Tab Bar Controller can jump to another view controller directly.
Wallace Wang

Chapter 19. Using the Page View Controller

Abstract
One unique way to display the contents of two or more view controllers is through a Page View Controller, which lets users swipe left and right. Each swipe displays a different view controller like swiping through pages in an e-book.
Wallace Wang

Chapter 20. Using the Split View Controller

Abstract
One of the most common user interface objects for displaying lists of information is the table view. When viewed on the narrow screen of an iPhone in portrait orientation, table views look fine. However, when viewed on the much larger iPad screen, especially in landscape orientation, a table view can look unbalanced with text appearing far to one side with empty space filling the majority of the screen as shown in Figure 20-1.
Wallace Wang
Additional information