The Development Tools, the Learning Approach, and the App Idea
So you want to create your own app? That's great! Creating an app is a fun and rewarding experience. I still remembered the joy when I first created an app years ago, even though the app is just so simple and elementary.
Before we dive into iOS programming, let's go through the tools you need to build an app and get prepared the mindset for learning iOS app development.
Apple has favored a closed ecosystem over the open system. iOS can be only run on Apple's own devices including iPhone and iPad. It is very much unlike its competitor, Google, that Android is allowed to run on mobile devices from different manufacturers. As an aspiring iOS developer, what this means to you is that you will need a Mac for app development.
1. Get a Mac
Having a Mac is the basic requirement for iOS development. To develop an iPhone (or iPad) app, you need to get a Mac with an Intel-based processor running on macOS version 10.14.4 (or later). If you now own a PC, the cheapest option is to purchase the Mac Mini. As of this writing, the retail price of the entry model is US$799. You can hook it up to the monitor of your PC. The basic model of Mac mini comes with a 3.6GHz quad-core Intel Core i3 processor and 8GB memory. It should be good enough to run the iOS development tools smoothly. Of course, if you have a bigger budget, get the higher model or an iMac with better processing power.
What about Hackintosh? Is it an option if you do not have a Mac? I heard that we can use it to run Mac on Windows machines. While you may have heard of some success cases of using Hackintosh for iOS development, it is not the recommended approach. If you are serious about learning iOS development and afford the upfront cost, a Mac is a worthwhile investment.
2. Register Your Apple ID
You will need an Apple ID to download Xcode, access iOS SDK documentation, and other technical resources. Most importantly, it will allow you to deploy your app to a real iPhone/iPad for testing.
If you have downloaded an app from the App Store, it is quite sure that you already own an Apple ID. In case you haven't created your Apple ID before, you have to get one. Simply go to Apple's website (https://appleid.apple.com/account) and follow the procedures for registration.
3. Install Xcode
To start developing iOS apps, Xcode is the only tool you need to download. Xcode is an integrated development environment (IDE) provided by Apple. Xcode provides everything you need to kick start your app development. It already bundles the latest version of the iOS SDK (short for Software Development Kit), a built-in source code editor, graphic user interface (UI) editor, debugging tools and much more. Most importantly, Xcode comes with an iPhone (and iPad) simulator so you can test your app without the real devices.
To install Xcode, go up to the Mac App Store and download it. If you're using the latest version of Mac OS, you should be able to open the Mac App Store by clicking the icon in the dock. In case you can't find it, you may need to upgrade your Mac OS.
In the Mac App Store, simply search "Xcode" and click the "Get" button to download it.
Once you complete the installation process, you will find Xcode in the Launchpad.
At the time of this writing, the latest version of Xcode is 11.1. Throughout this book, we will use this version of Xcode to create the demo apps. Even if you have installed Xcode before, I suggest you upgrade to the latest version. This should make it easier for you to follow the tutorials.
4. Enroll in the Apple Developer Program (Optional)
A common question about developing an iOS app is whether you need to enroll in the Apple Developer Program (https://developer.apple.com/programs/). The short answer is optional. First, Xcode already includes a built-in iPhone and iPad simulator. You can develop and test out your app on Mac, without enrolling in the program.
Starting from Xcode 7, Apple has changed its policy regarding permissions required to build and run apps on devices. Before that, the company required you to pay US$99 per year in order to deploy and run your apps on a physical iPhone or iPad. Now, program membership is no longer required. Everyone can test their apps on a real device without enrolling in the Apple Developer Program. Having said that, if you want to try out some advanced features such as in-app purchase, push notifications or CloudKit, you still need to apply for the program membership. Most importantly, you're not able to submit your app to App Store without paying the annual membership fee.
So, should you enroll in the program now? The Apple Developer Program costs US$99 per year. It's not big money but it's not cheap either. Since you're reading this book, you're probably a newcomer and just start exploring iOS development. The book is written for beginners. We will first start with something simple. You are not going to tap into the advanced features until you grasp the basic skills.
Therefore, even if you do not enroll into the program, you will still be able to follow most of the content to build an app and test it on your device. For now, save your money. I will let you know when you need to enroll in the program. At that time, you're encouraged to join the program as you're ready to publish the app to the App Store!
The Learning Approach
I have been teaching iOS programming from 2012 through blogging, online courses, and in-person workshops. What I found is that it is the learning approach and the mindset that make the difference between failing and achieving. Before we talk about Swift and iOS programming, I want to get you equip with the right mindset and understand the most effective way to learn programming.
Get Your Hands Dirty
One of the most popular questions about learning how to code is:
What's the best way to learn iOS programming?
First, thanks for reading this book. Unfortunately, I have to tell you that you cannot learn programming just by reading books. This book has everything you need to learn Xcode, Swift, and iOS app development.
But the most important part is taking action.
If I have to provide an answer to the question, I will say "Learn by Doing". It is at the heart of my teaching approach.
Let me change the question a little bit:
What's the best way to learn English (or other foreign languages)?
What's the best way to learn cycling (or any other sports)?
You probably know the answer. I especially like this answer on Quora about learning a new language:
Follow this routine: listen 1 hour a day, speak 1 hour a day, publish 1 journal entry.
- Dario Mars Patible
You learn through practice, not by just studying grammar. Learning programming is somewhat very similar to learning a language. You need to take actions. You have to work on a project or some exercises. You have to sit in front of your Mac, immerse yourself in Xcode, and write the Swift code. It doesn't matter how many mistakes you make during the process. Just remember to open Xcode and code while reading this book.
Why do you want to learn app development? What motivates you to sacrifice the weekends and holidays to learn how to code?
Some people begin learning app development just because of money. There is nothing wrong with that. You may want to build your app business to earn some side income and eventually turn it into a full-time business. That's completely understandable. Who doesn't want to live a rich life?
As of March 2018, however, there are over 2.1 million apps on the App Store. It is really hard to put up an app on the App Store and expect to make a load of money overnight. You'll be easily discouraged or even give up if money is your primary reason for building apps, especially when you come across articles like this:
- How Much Money I Made on the App Store (https://sitesforprofit.com/how-much-money-app-store)
Then reality set in.
199 units old = US$209 in sales = US$135 proceeds (net to me). In order to get the app on the app store I needed to pay the $99 developer fee.
So after 2 months and 1 week my (before tax) profit was $36.
Programming is hard and challenging. I find people who successfully master the language are those who have a strong desire to build apps and are enthusiastic to learn programming. They usually have an idea in their mind and want to turn it into a real app. Making money is not their number one concern. They know the app can solve their own problems and will be beneficial to others. With such a powerful purpose in mind, they can overcome any obstacles come up.
So, think again why you want to learn programming.
Find a Buddy
"The best way to learn is to teach" is an old saying. It still works in the modern world, however. You don't need to be an expert to teach. I'm not talking about giving a lecture at a university or teaching a bunch of students in a formal class. Teaching does not always happen that way. It can be as simple as sharing your knowledge with a colleague or a classmate sitting next to you.
Try to find someone who is also interested in learning iOS programming. When you learn something new, try to explain the materials to your buddy. For example, after building your first app, teach your close friend how it works and how he/she can create an app too.
What if you can't find a buddy to share what you've learned? No worries. Start a blog on medium.com (or whatever platforms you like), write a blog post every day, and document everything you learn.
This is one of the most effective ways of learning as I learn so much while publishing tutorials on appcoda.com, as well as, developing my first book.
Sometimes you think you know the materials well. But once you need to explain the concept to someone else and answer questions, chances are that you didn't understand the material thoroughly. And this will motivate you to study the materials even harder. Give this method a shot while you learn iOS programming.
Grit is passion and perseverance for very long-term goals. Grit is having stamina. Grit is sticking with your future, day-in, day-out. Not just for the week, not just for the month, but for years. And working really hard to make that future a reality. Grit is living life like it’s a marathon, not a sprint.
- Dr. Angela Lee Duckworth
Some of my students asked, "How long would it take to become a good developer?"
It takes time to master programming and become a great developer. It usually takes years. Not weeks, not months but years.
This book will help you kick start the journey. You will learn all the basics of Swift and iOS programming and eventually, build an app. That said, it takes time and lots of practices to become a professional programmer.
Be patient. Don't set your expectations too high for your first app. Just enjoy the process, create something simple and fun. Keep reading and coding daily. You will eventually master the skill.
Find Your App Idea
I always encourage my students to come up with their own app idea when start learning app development. This idea doesn't have to be big. You do not need to build the next Uber app or come up with a new idea to change the world. You just need to start with a very small idea that solves a problem.
Let me give you a couple of the examples.
One classic example that I used to mention is Cockpit Dictionary. It is an app built by Manolo Suarez, who is a pilot by profession. He had an app idea while learning app programming. The idea was not fancy but solved his own problem. There are tens of thousands of Aviation terms in abbreviated form. Even for an experienced pilot with over 20 years of aviation experience, it is impossible to remember all the acronyms and technical terms. Instead of using a print dictionary, he thought of building a handy app for pilots to look up all kinds of Aviation terms. A simple, yet a great idea to solve his own problem.
Another example is the NOAA Buoy Data app. This app retrieves the latest weather, wind, and wave data from the National Oceanic and Atmospheric Administration’s (NOAA) National Data Buoy Center (NDBC). Developed by Leo Kin, he came up with the app idea during his recovery from surgery.
"After the surgery, I had to wear a neck brace for three months. During those three months, I couldn’t move a lot and even had a hard time walking or even raising my arms. My physical therapist advised that I go walking as much as I can to get exercise and to build back my atrophied leg muscles.
There is an island close to where I was living that I really enjoyed walking to. The only problem was that it can only be reached during low tide. And if the tide came in, there’s no way to get back home except by swimming. Since I was very physically weakened, I was very scared of getting stuck on the island with no way back. While walking, I was always going to NOAA’s website to check how high or low the tide was and if I had enough time to walk to the island and back.
During one of my walks, the idea came to me that I should build an app. Even if no one else uses the app, it wouldn’t matter because it would help me keep track of the tides and get back in time."
- Leo Kin
His app may not interest you, but it was solving a problem he faced at the time. Probably people on that island would benefit from his app too.
Having your own app idea will give you a clear goal and motivate you to keep learning. Now spare some time and write down three app ideas below:
That's all for the introduction. Take some time to install Xcode on your Mac, and come up with your own app idea. Even though I may not teach you to build the exact same app, you will learn the coding techniques that empower you to build your own app.
When you proceed to the next chapter, we will start programming in Swift.
So get ready!
To continue reading and access the full version of the book, please get the full copy here. You will also be able to access the full source code of the project.