Introduction to iOS Development: Getting Started
Module 1 of the Free Swift Journey Course. We’ll discuss minimum requirements to code an iOS application, resources needed and overall development environment.
Welcome to the first module of your Swift Journey! As your gateway to the world of iOS development, this module will cover essential prerequisites for coding iOS applications. We’ll first discuss minimum system requirements. Then, we’ll talk about creating an Apple developer account. Next, we’ll cover setting up your first project, downloading and navigating Xcode. Whether you’re a beginner or brushing up on your skills, I designed this as “what I’d have liked to know prior to diving straight into coding”. So, I hope you’re ready to begin, take some notes, and don’t hesitate to share your thoughts with me at the end!
Minimum Requirements
Let’s first discuss essential hardware. You probably guessed it - the main hardware requirement for running and coding iOS applications is going to be a Mac computer. For starters, I recommend something straightforward and yet capable, like a MacBook Air with 8GB RAM and 256GB SSD. With Apple’s latest advancements, I’d also highly recommend getting an M-series chip device. M1 should be fine. This has a starting cost of $999. This is more than enough to start your journey. Here’s a direct link for it if you’d like to purchase this model: MacBook Air
If you are already a Mac owner, don’t worry about upgrading it to an M chip. Intel-based Macs will work just fine for learning and development purposes. To help you better understand the options and requirement, I’ll include a link here for a Medium article that I think offers a great summary on the topic.
Now, while it’s technically possible to run macOS on non-Apple hardware - creating a system called “Hackintosh” - I don’t recommend it. It’s a complex process and not the best way to start your iOS journey. I’ll leave a link here to a website you can explore further if you wish to learn more about it: https://hackintosh.com
Final thoughts on this, get a mac if you can, whether that means purchasing one or borrowing it from someone. Having a personal one will greatly improve your learning experience. The goal here is to create a comfortable and efficient development environment that supports you and your journey.
Apple Developer Account
The next thing you’ll want to do is to create a free developer account with Apple at https://developer.apple.com. With this, you’ll have access to a wide range of development tools, documentation and other resources we’ll cover in later modules.
Once you have your macOS in hands and your free developer account - head over to this website https://developer.apple.com/xcode in order to download XCode. This will be your primary development environment for creating iOS apps. Make sure to download the latest XCode version. Install all the required components it prompts you for, including the latest version of Swift (at the time of writing, it should be about 5.9). Now, let’s get onto setting up your first project!
Setting up your first project
Open up your Xcode, and you will be presented with 3 options:
Create New Project
Clone Git Repository
Open Existing Project
In this tutorial, we’ll focus on creating a new project locally, without using Git. We’ll discuss Git and its functionalities in a later time when we talk about version control and conflict resolution. For now, go ahead and click “Create New Project…”
After creating a new project, here’s a quick overview of the next steps you must follow to start your project:
Choose the App template: Select the App option from the screen.
Name Your Product: Give your product a name. It can be something like “My First Swift Project”.
Select a Team: You might need to login with your newly created developer account.
Organization Identifier: If you don’t currently own one, you can simply use com.example as a placeholder. This is a reverse DNS string that identifies your company. If you plan on distributing your app, you’ll need to change this later down the line. For now you can use something like com.example.alias.
Interface: Select “SwiftUI” as your interface.
Language: Select “Swift” as your language.
Default Settings: You can leave the rest of the settings at their defaults.
It should look something like this now:
Now you can select “Next”, select a location to save your project, and we’re ready to navigate XCode!
Navigating XCode
Upon opening XCode, you will be greeted with multiple screens, numerous buttons, along a few folders and files to the left hand-side. My goal is to highlight some of the main functionalities and give a brief description of each. As we progress further with our project, we’ll discuss the other functionalities not mentioned here as well.
I’ve designed this visual aid to help you understand what each of these mean and what purpose they serve:
Project Navigator: This is where you can find all related files to your project. You can see a blue looking icon, which is your main project file, followed by folders, and within those, different files.
Editor Area: This is where the magic happens - the coding area. You can see in this example, I have
ContentView.swift
opened, with some example code - this gets generated by default when you setup your project. This is a default basic SwiftUI structure for a View, which is something we’ll cover later on.Preview: One of the great things that XCode provides when it comes to developing UI, is the ability to preview your Views. This is the panel where all of this happens. You can see how your app will look on an actual device, without having to run the simulator. You can also input data and customize the View however you want it to look like for testing purposes.
Play Button: This is what will be used to build and run projects. Once running, you’ll also be presented with a stop button that can be used to pause your project as needed.
Toolbar: This toolbar highlights which project you’re building, and on which device. You can choose from a wide range of available devices to run your project. You can also monitor build success and failures.
Code Review : As you make changes to your source code in a repository, Xcode will track those changes and highlight them in the project navigator. While you’re working on a change, toggling this button will allows you to see your changes in the current branch directly on your code editor.
Editor Options: This button allows you to adjust the appearance and behavior of your code editor. It will give you a series of options in its dropdown. You can alter the layout of your code editor, toggle a minimap display, highlight syntax, wrap code, and other features.
Library Button: This wonderful plus sign will open a panel with UI components and code snippets that can be simply dragged into the editor. It’s particularly helpful if you’re just starting with Swift. It allows you to learn the syntax, drag and drop UI elements directly in the editor, and read up on the documentation. There are many examples and actual code you can leverage from this, without leaving XCode.
Inspector Panel: When active, this panel gives information about the selected file or UI element. This is also where you can go to update the name of your file, switch target memberships, and other settings we’ll discuss in later modules.
Final Thoughts
I know this may seem like a lot of information at once. I’d love to hear your thoughts and feedback on the content itself. My goal is to improve as we go, as well as make it a smooth experience for you to read and act on this new knowledge you’ve gained.
Navigating a new project, language, and a new code editor can be overwhelming - so I want you to feel as comfortable as possible doing so. Which is why, I’ll be publishing a series of small (or sometimes bigger) optional tasks and challenges for you to accomplish in between posts. With this, I hope to fill you in with enough entertainment and hand-on experience prior to the next post.
Task
Your first task is to experiment with the Library items in Xcode. Play around with some of the available items. Try dragging and dropping some UI components and code snippets. This can help you become more familiar with the syntax and what Swift has to offer!
Thanks for reading,
Ricardo Leite