Many resources teach you how to make an app but neglect to emphasize amazing resources like Stack Overflow and GitHub, which were critical to accelerating my learning and creation of my first app.
In this blog series, I will lay out my advice to help you get over the hump of building your first app as quickly as possible. Your goals should be to get enough understanding of coding so that you can:
- Understand Apple’s official documentation
- Understand questions and answers in Stack Overflow
- Utilize and modify open source projects for your own app
Once you can do these 3 things, you’ll be well on your way to creating your first app. Not to say you’ll be a seasoned developer, but you’ll have what you need to build a great first app.
Another part that is typically not covered is learning marketing and design, of which there are a lot of resources out there but were unknown to me as well. Part 2 will cover these topics in a similar fashion as this with the approach of getting a solid foundation and taking advantage of online resources.
Starting off with an idea and sticking to your books
At this first stage, you need to learn the basics by just going through a beginner class, tutorial or books.
Pick whatever you think will work best for you and stick with it. Unless you totally lose faith in the resource you selected, don’t be tempted to buy more books or videos instead of doing the work (I made this mistake!).
What ended up working for me was committing to the two books below. They were highly recommended from many sources and they pair up well one after another since they’re from the same company.
- Objective-C Programming: The Big Nerd Ranch Guide (non-affiliate link)
- iOS Programming: The Big Nerd Ranch Guide (non-affiliate link)
These books were great because they start off with small ideas and expand on them appropriately, giving you a deeper understanding of what’s going on and the exercises at the end of each chapter force you to stretch your understanding and learn on your own. Both of those are critical to you being able to create your own app.
It wasn’t until near the end of the second book that I was able to really start on my app with any confidence and not get completely stuck.
Even if you end up using different books or doing something else, digest as much as you can and use this time to practice the techniques in the “Finding Answers” section below.
Once you’re done with the books or close to finishing, start making your app and don’t feel bad about referencing or copying code that you used while learning. In fact I’d recommend your first project to rely heavily on what you learned so that you actually prove to yourself that you learned it.
Finding answers
Once you start making your own app or are working on the exercises in the book, you’ll encounter specific questions that you’re curious about or need help out on but can’t figure out through the book.
Your first resource should be Apple’s extensive documentation, which is included with Xcode (shortcut cmd+ctrl+?) and online. It’s essential you get used to the way it’s laid out and the language they use to explain things, as the faster you learn this, the easier time you’ll have in the long run. The documentation is really great, but at first I really didn’t understand anything. Fortunately Apple documents everything in a consistent fashion, which means once you get a hang of it, almost everything starts making sense.
Optional: I use Dash to search the documentation since I found it more user friendly to navigate the documentation and faster than Xcode’s documentation browser.
Next, leave a browser open to Stack Overflow at all times. It is the greatest resource for finding answers to programming questions. If you haven’t used it before, it’s a Q&A site for developers and since you’re a beginner like me, most likely your question has already been asked and already answered by other people. Additionally, if you can’t find an answer, you can ask one and it usually gets answered within 24 hours.
Although it’s a great resource, it can be tough finding answers at times so here are some tips:
- Use the search function and add [ios] to your searches. The brackets mean it’ll filter to only questions tagged [ios]
- When reading questions and answers, read anything that sounds related. Often I get answers from questions that are different but the answer still covers what I need to know
- While the top answer is usually the best, read some of the other highly rated answers and any comments. Sometimes your situation will be better answered by a non-top answer or the top answer won’t be current with updates to iOS
- If you can’t find the answer you need, try new searches using these techniques:
Remove the [ios] tag and instead use a related tag like [iphone], [ipad], [objective-c]
- Start with a specific search and then make it more general to see if you can find different questions and answers
- Replace official class names with unofficial ones and vice versa, e.g. UIViewController vs view controller
- Each question page has a related questions on the right side, be sure to check if there are other questions that might hold your answer
- If the above fails, don’t be scared to ask a question. Just make sure you follow the rules and try answering questions sometime to test your knowledge and give back to the community
Optional: Using Stack Overflow means you have a browser window open that can tempt you to visit Hacker News or Facebook instead of coding, so I recommend using SelfControl or opening it in a browser that you never use and so have no bookmarks around to tempt you.
If none of those turn up answers, do a Google search and check the Apple developer forums.
Lastly, ask other developers for help or just talk about development in general. Although I have few iOS developer friends, discussions with more seasoned developers helped me understand different concepts and explaining Objective-C and Cocoa touch to them helped me make sure I really understood what I was doing. Additionally you may have an iOS group/meetup in your area that can be a great resource. (If you’d like to chat, feel free to email me!)
Using open source code
Being stuck because you have absolutely no idea how to start is common at the beginning and using or referencing someone else’s code is one of the best ways to learn and gain confidence. I can’t emphasize how many barriers are lowered when you utilize open source code.
At times it feels like you’re cheating, but that really is just showing you the power of open source code and why it is so amazing.
Open source code are basically projects and pieces of code that people have written that either are made to be used by others or full projects on their own. What will be most useful to you for using are the code to be used by others. If you want example code to reference, then full projects of similar apps to what you are building are useful but rare.
An example is that I wanted to have the Facebook/Path style navigation where you hit a button on the top left and a menu slides in. Here it is implemented in my app:
I added this to my project by finding an open source project that replicated that navigation called ZUUIRevealController by Philip Kluz. It comes out of the box with an example like this:
As you can see in the screenshots above, not everything will work or look how you want just by copy and pasting their projects. People created their code for specific uses or didn’t implement features that you need, so you often have to make modifications to their code. This is the part where you’ll probably learn the most from others code.
You’ll have to reverse engineer what they did by reading and understanding their code and then in order to customize it the way you want you’ll have to modify it. Some projects are easier to change than others and many come with ways built in to customize their projects, but at the end of the day you’re using someone else’s code, who is probably a much better coder than you, so you’ll learn a lot.
How to use GitHub
The site I used most is GitHub. GitHub is a place that hosts open source projects (and private projects) that anyone can contribute to or make their own variation. Although GitHub can be really intimidating, you only need to know a little to take advantage of it.
Starting off, think of a single component/feature of your app that you need. For example, some components I needed for my app were a youtube player, a photo gallery, social sharing and in-app purchases.
Search for your component in GitHub’s search box and hit enter. It’ll give you some results, as well as advanced options. Change the Search Language to Objective-C and search again to show open source projects related to iOS (and mac, which you’ll have to filter out yourself by looking at the project descriptions but almost everything is iOS).
In GitHub, search and then refine the Search Language to Objective-C.
At this point I’ll go over the basics to get going immediately and then some tips to more effectively use GitHub. Click on one of the projects (GitHub calls them repositories) and scroll down to the Readme sections for a description and help on how to use the code. If it doesn’t include anything helpful in the readme, I would recommend not using the code since you’re just starting out.
If you find something you like, simply click the Zip button and it’ll download the entire repository.
Most repository will have an example Xcode project file that uses the code itself and then have instructions on how to install it into your own project in the readme file (or on GitHub). Often the author’s offer up their email address for help as well. If it’s a popular project you often can find answers in Stackoverflow though too.
Now that you know the basics, some background knowledge of GitHub will help you get the most out of it. The first thing is that in Github, anyone can copy a repository, modify it and post it on GitHub (called a fork) and so you’ll often see copies of the same repository made by different people in the search results like the screen shot below. Typically you’ll want the originating project, not someone’s copy/fork. The first part of the name is the username (lwz7512 and bsfan) and the second is the name of the repository (PhotoGallery).
The originating repository typically is the first one listed in the search results, but you can make sure by going to the link and seeing if it says “forked from ____”. If it is forked then it is a copy and you can click the repository it’s forked from to go to the original.
Additionally, often in the code description area (or in the readme) there is a link to the original source or a page that talks about the repository that can give you more information and instructions on how to use the repository.
One of the best signs to know if a project is a quality project you should use and therefore likely well documented, easy to use and robust, is if it has a lot of stars and forks as shown in the top right of the repository page.
In the image above, I’m signed in and have starred this project. If you want to bookmark projects and contribute to them eventually, I highly recommend you sign up for a GitHub account to do this.
Optional: Try using SourceTree to pull (sync) updates for these projects. The advantages of this are that when people update the repositories to fix bugs or add features, you can request your files to be updated as well.
To help get you started, here are some repositories that I think almost every app could use:
- Appirater - Asks a user to rate your app in the App Store after an amount of days, app launches and/or actions you set
- SVProgressHUD - A simple way to show a loading or other temporary message to the user
- TSMiniWebBrowser - A web browser for your app so you can show a web page that you can update outside the app, e.g. blog and FAQ
Optional: Instead of looking for new controls all the time, Cocoa Controls has a weekly email on their website that sends out new submissions. It’ll give you ideas of what you can add to your app or just key you into projects you can take a look at to see their inner workings.
What’s next?
While coding is a huge chunk of the process, there’s a lot more to it. In the coming weeks I’ll be following up with posts on resources and tips I used to finish and submit my app, along with anything I think would help other beginner iOS developers.
Please send me an email if you have any advice, comments or suggestions for a beginner iOS developer. I’m looking for iOS developer friends :)
Check out the original post and more resources on Billy’s blog.