iOS13 and Swift

Beginning iOS13 and Swift App Development!

Welcome to Beginning iOS13 and Swift App Development! I am Greg and I am so excited that you decided to come along for this. With this book, you will go from absolute beginner to having your app submitted to the App Store and along the way, equip yourself with valuable iOS app development skills.

Working Through This Book

This book is purposely broken down into nine chapters where the development process of each chapter will center it on different essential iOS topics. The book takes a practical hands-on approach to learning through practice. You learn best when you code along with the examples in the book. Along the way, if you encounter any problems, do drop me a mail at support@i-ducate.com where I will try to answer your query.

Get a Mac

Before we proceed on, you will need to have a Mac running on at least macOS version of 10.14. Because Xcode 11 and iOS 13 leverages on macOS Catalina (10.15), I highly recommend that you get macOS Catalina. This is especially important when we decide to develop our user interface with SwiftUI as described in chapter ten.

If you do not yet have a Mac, the cheapest option is to get a Mac Mini and if you have a higher budget, get a higher model or iMac with more processing power. You might have heard of the option to run Mac on Windows machines for iOS development, but I do not recommend it. Unexpected problems will arise in development and publishing to the App store that can be avoided by just using a Mac. If you are serious about developing iOS apps and publishing them on the App Store, getting a Mac is a worthwhile investment.

Downloading Xcode

Next, there is an essential piece of software you need to have on your computer before we can move forward. It is called Xcode and is an integrated development environment (IDE) provided by Apple to write Swift code and make iOS apps. It includes the code editor, graphical user interface editor, debugging tools, an iPhone/iPad simulator (to test our apps without real devices) and much more. Let us go ahead to get it downloaded before proceeding.

Download the latest version of Xcode 11.1 (at time of writing) from the Mac App Store (fig. 1.1).

(fig. 1.1)

You will need an Apple ID to login and download apps from the Mac App store. If you do not already have one, go ahead and sign up for an account (https://appleid.apple.com/account). You will also need an Apple ID to be able to deploy your app to a real iPhone/iPad device for testing. The installation of Xcode might require you to update

your version of MacOS. At this book’s time of writing, the MacOS required is Mojave version 10.14. But as mentioned earlier, we recommend that you update to Catalina version 10.15.

Installing Xcode

Just like any other Mac App, Mac App store will take care of the downloading and installation of Xcode for you. Do note that installation of Xcode 11 requires 20-30 GB of space available for the installation to proceed and installation does take quite some time. Once the installation is complete, you should see the Xcode icon on your computer.

Swift and Xcode

I am going to be introducing you to two terms that you are going to encounter throughout this book. One of those is Swift and the other one is Xcode. Swift is the programming language we use to make iPhone apps. Swift came out in 2014. Before that, the programming language used to make iPhone apps was Objective C. But Objective C was complicated. Many developers new to the space of iOS development found that it was hard to read and write. Swift then was introduced. Swift is specifically designed with beginners in mind and even experienced programmers think of Swift as a clean and beautiful language.

Xcode is the program that allows us to make iPhone apps. We are going to type Swift into Xcode and also use Xcode for designing the visual side of our app like where do we want a button, what color do we want it to be, where do we want to place our table view, etc. So, throughout this book, these are the two skills that we will be improving upon step by step.

This course was written for a beginner in iOS development. So, if you have some iOS development experience, you are going to feel familiar with what is going on. It will also be best if you have some basic programming experience. But if you do not have it, it is alright as well as I will try my best to explain certain programming concepts.

Xcode Walkthrough

Now in this section, I want you to become acquainted with Xcode. Go ahead and open Xcode.

At the time of writing, this book uses Xcode 11.1. But make sure you are using the latest official version of Xcode from the Mac App Store.

In the Welcome to Xcode’ screen (fig. 1.2), you can choose to either get started with a playground which is a great way to explore the Swift language. The next option is creating a new Xcode project where you create an app for iPhone, iPad, Mac, Apple Watch or Apple TV.

Figure 1.2

You also have a third option to clone an existing project, but we will not be covering this option in this book.

For now, let us go ahead and create a new project.

When you do so, it is going to bring up a page (fig. 1.3) that asks what kind of project you want to make, whether iOS, watchOS, tvOS, macOS or Cross-platform.

Figure 1.3

iOS includes apps for the iPhone, iPad, iPod Touch. watchOS is for Apple watch apps. tvOS is for Apple TV apps. macOS is for Mac apps on the desktop and Cross-platform is if you want to make an app that works across multiple platforms. For us, we will be focusing on iOS apps.

For an iOS app, there are lots of different templates that you can start with. The templates help you get started with some boilerplate code. For us, we want the Single View App. This is essentially the blank starting point for almost every app that we are going to make. So, let us go ahead and double click on that.

You will then have to input the below fields for your project (fig. 1.4):

Product Name: (as this is our first project, we will name it HelloWorld)

Team: Organization

Name: Organization

Identifier: (normally the reverse of your website e.g. com.iducate.calculator. If you do not have a website, com.firstname.lastname will do fine)

Language: select Swift

User Interface: select Storyboard

For Use Core Data, Include Unit Tests, Include UI Tests: leave all the boxes unchecked

Figure 1.4

*Note: In the User Interface field is an option to select SwiftUI or Storyboard. SwiftUI is a new way of implementing user interfaces introduced in Xcode 11 and iOS 13. It is very cool but there are certain things that it cannot handle yet. Eventually, it will be the way to make apps, but for now, it is not quite ready. So, we will select Storyboard which had been the established way of designing interfaces. If you are interested in SwiftUI, we will be introducing it in chapter ten.

Go ahead and fill in the fields. You can change the field values later in your project, so do not worry if you have inputted a wrong value.

When you have the fields filled up, hit the Next button. It is going to ask you where you want to save this new project. I am going to put ours on the desktop.

There will also be a checkbox to Create Git repository on my Mac. This will make a GitHub repository for your app which helps you save different versions of your app and if you want to collaborate with people. Git is outside the scope of this book but just go ahead and leave this checked.

You can see that a new folder has been added to our desktop called HelloWorld. On the left side of Xcode, you can see the folder-file structure of the project (fig. 1.5).


 

 

 

 


iOS13 and Swift iOS13 and Swift Reviewed by bsm on May 06, 2020 Rating: 5

No comments:

Powered by Blogger.