Book Image

iOS 14 Programming for Beginners - Fifth Edition

By : Ahmad Sahar
Book Image

iOS 14 Programming for Beginners - Fifth Edition

By: Ahmad Sahar

Overview of this book

If you're looking to work and experiment with powerful iOS 14 features such as widgets and App Clips to create your own apps, this iOS programming guide is for you. The book offers a comprehensive introduction for experienced programmers who are new to iOS, taking you through the entire process of learning the Swift language, writing your own apps, and publishing them on the App Store. Fully updated to cover the new iOS 14 features, along with Xcode 12 and Swift 5.3, this fifth edition of iOS 14 Programming for Beginners starts with an introduction to the Swift programming language and shows you 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 storyboards feature in the latest version of Xcode and implement the code for views, view controllers, data managers, and other aspects of mobile apps. The book will also help you apply iOS 14 features to existing apps and introduce you to SwiftUI, a new way to build apps for all Apple devices. Finally, you’ll set up testers for your app and understand what you need to do to publish your app on the App Store. By the end of this book, you'll not only be well versed in writing and publishing applications, but you’ll also be able to apply your iOS development skills to enhance existing apps.
Table of Contents (31 chapters)
1
Section 1: Swift
10
Section 2:Design
15
Section 3:Code
24
Section 4:Features

Downloading and installing Xcode from the App Store

Before you begin writing iOS apps, you need to download and install Xcode from the App Store. Follow these steps:

  1. Choose App Store from the Apple menu.
  2. In the search field in the top-right corner, type Xcode and press the Return key.
  3. You should see Xcode in the search results. Click Get and click Install.
  4. If you have an Apple ID, type it in the Apple ID textbox. If you don't have an Apple ID, click the Create Apple ID button and follow the step-by-step instructions to create one:
    Figure 1.1 – Apple ID creation dialog box

    Figure 1.1 – Apple ID creation dialog box

    Important information

    You can see more information on how to create an Apple ID at this link: https://support.apple.com/en-us/HT204316#appstore

  5. Once Xcode has been installed, launch it. You should see the following Welcome to Xcode screen. Click Create a new Xcode project in the left-hand pane:
    Figure 1.2 – Welcome to Xcode screen

    Figure 1.2 – Welcome to Xcode screen

  6. You will see the new project screen as follows. In the Choose a template for your new project: section, select iOS. Choose App and then click Next:
    Figure 1.3 – Choose a template for your new project screen

    Figure 1.3 – Choose a template for your new project screen

  7. You will now see the Choose options for your new project: screen:
    Figure 1.4 – Choose options for your new project screen

    Figure 1.4 – Choose options for your new project screen

    Configure this options screen as follows:

    • Product Name: The name of your app. Enter ExploringXcode in the text field.
    • Organization Identifier: Used to create a unique identifier for your app on the App Store. Normally, reverse DNS notation is used. Enter com.yourname for now.
    • Interface: The method used to create the user interface for your app. Set this to Storyboard.
    • Language: The programming language to be used. Set this to Swift.

      Leave the other settings at their default values. Make sure all the checkboxes are unticked. Click Next when done.

  8. You'll now see a Save dialog box. Choose a location to save your project, such as the Desktop or Documents folder, and then click Create:
    Figure 1.5 – Save dialog box

    Figure 1.5 – Save dialog box

  9. If you see a dialog box saying No author information was supplied by the version control system, click Fix.

    Important information

    The reason why you see this dialog box is because the Source Control checkbox is ticked. Apple recommends that Source Control be turned on. To learn more about version control and Git, refer to the following link: https://git-scm.com/video/what-is-version-control

  10. You will see the Source Control preference screen as follows:
    Figure 1.6 – Source Control preference screen

    Figure 1.6 – Source Control preference screen

    Enter the following information:

    • Author Name: Your own name
    • Author Email: Your email address

      Close the Source Control preference screen by clicking the red button in the top-left corner when done.

  11. The Xcode main window will appear.

Fantastic! You have now successfully downloaded and installed Xcode and created your first project. In the next section, you will learn about the Xcode user interface.