Mentor Léo - iOS : Week 1/Day 1
Mentor Léo is a free community of Léos coming from all over the world with the same motivation of doing the best to change their life and to become a professional developer from scratch 💪.
This series is focused on how to become a native Mobile Developer, on iOS and Android. The Android part will follow the iOS one, subscribe to be informed about the different releases!
If you want an overview about this week, have a look on the introduction article on medium.
Requirements and setup
If you want to become an iOS developer, the first thing that you need is to run a computer on MacOS.
It’s always a non-negligible budget to buy a Mac and if you can’t have access to any Mac around you I advise you to start by purchasing a Mac Mini which is the cheapest way for you to start the iOS development. You can also search in refurb products on the Apple Store website where you can sometimes find great offers.
If you are motivated you can also try to install MacOS (Google Hackintosh) on your PC but its a long and difficult task with a lot of problems at the end (due to the lack of proper drivers for your hardware to be recognised and to work properly).
Once you’re running on the MacOS system, we’re ready to setup your developer environment 🙌. Follow the different steps:
- Create an Apple ID: https://appleid.apple.com/account
- Connect to the Apple Developer website with your fresh ID: https://developer.apple.com/account/
- Download the latest version of Xcode on the Mac App Store or (by following a direct download link.)
- Launch Xcode and install the mandatory packages
And you’re ready to launch your first iOS project on an iOS Simulator 🚀.
If you have an iOS device and you want to develop on it, you will first have to purchase an Apple Developer Program which is about 100$/year. We don’t need to build on a device for this project. I suggest you to wait for your own awesome future project to purchase the Apple Developer Program and ship your app in the App Store 😎.
I suppose you have a minimal understanding on what is a program, a computing language and in what consist the job of a developer (yeah be sure to check this before jumping into the ocean…).
In few words: A developer his a person who uses at least his hands, ideally his brain, to communicate with a computer by writing some programs using a list of instructions. A program is like a book constituted by a lot of lines of code (instead of a lot of lines of english for a good roman). Like you read a book, the computer will execute a program by reading the lines of code. You write human readable lines of code and it’s translated (we use the term compiled) in a machine language so the computer can understand it. The term computer designates everything running an Operating System (the guy who brings all the hardware components to life): a PC, a Mac, an iPhone etc.
Today, there are a lot of different programming languages for many different purposes but here we will focus only on one! To write iOS apps you can use the Objective-C language or a most recent language released by Apple few years ago now: Swift.
We will only see Swift because it is now a strong and stable language, pleasant to write and read. Moreover, without any doubt, it will be the future of all the Apple developer ecosystem.
While you learn Swift, you will be able to test your code by using playgrounds. Playground are just like “ready to launch” programs where you can play with code which is executed instantaneously. You will taste the playgrounds while making the guided tour of the Swift Book.
Day 1: Swift + Xcode = ♥️
Exercise one: Swift is the right way
The best way for you to learn Swift:
- Get the Swift book and read the chapter named A Swift Tour (should be the first one)
- While reading this chapter or after it, download the associated playground (the sandbox to play with Swift, remember?) and try to do the exercises on your own. By playing with the code, you will have a better understanding on what you are doing and learn more quickly
- Play with this playground again and again, until you memorise all the basic concepts of the language
- You can then review your knowledges on learnXinYminutes.com
Extra: If you don’t have a Mac yet and you want to learn Swift first, you can use this awesome Swift web playground project launched by IBM.
Brilliant! After this exercise you should know the basis of this awesome language and you are ready to deal with an IDE to write some code in a real app.
Exercise two: Xcode is your tool
- Launch Xcode and create a new Single View Application
- Open the AppDelegate.swift file
Pro-tip 😎: use CMD+Shift+O to make a quick search on files or methods in your project.
- Search for the method
didFinishLaunchingWithOptionsand add a line of code which prints “Hello Mentor Léo 🖐” in the Xcode console.
Did you notice? - Thanks to Unicode implementation Swift supports emojis in code!)”
- Run your application
Pro-tip 😎: use CMD+R to run your app.
And you’re done. Congrats! You’ve created and run your first iOS app! 🙌
See you on Day 2 to start building-up our profile view app 💪.
Call to action
Join us ! We are creating a community of motivated Léos helping each other. Apply here, it will always be free ♥ https://mentorleo.co