This course is a quick introduction to XCode and Apple's app building environment. At the end of the course you will have built your first simple button app in XCode 5.
**Please note: Since we build in Apple's native environment this course requires you to have a Mac running OS 10.8+ in order to install XCode. This is an Apple mandate.
The left side panel in XCode is known as the Navigator.
This is where all the files included in your project are located. You can search for things, analyze errors, and add break points among a host of other things. When you click on a file, its contents will be shown in the center screen. To view two files at once, simply hold down the "option" key and click a file.
The right side panel is known as the Inspector.
In the inspector, you can add UI (user interface) elements to your application. Furthermore, you can change the size and physical properties of those elements here.
The bottom panel is referred to as the debug console or debugger.
When you recieve errors (and you will!), this is where they show up.
And as shown in the video, all of these views can be toggled with the three buttons on the top right of XCode.
We will be using each of these areas extensively throughout the course, so you will have plenty of time to get comfortable with them!
For reference, the code that was written to change the label's text is as follows:
self.titleLabel.text = @"Hello Class!";
You will learn what all of this means shortly! But for know, notice how the statement between the curly braces sounds somewhat similar to English. This is not by mistake, but instead a characteristic of Objective-C, the programming langugage in which most iPhone apps are written in.
The dot notation signifies "ownership" and can be read as "self's titleLabel's text is equal to Hello Class." Right now, the word "self" sounds a little goofy but bear with me- it's another way of saying "My."
You want to change your Label to display the word "Goodbye."
Try playing around with the attributes inspector (the area on the right side of the screen). Click on your label, and see if you can change it's background to green and try making the font a bit bigger. The best way to learn is to experiment- so go ahead!
Try adding one more View Controller Object to your storyboard and then transitioning, or in iOS speak, "segueing" to that from your View Controller with the world on it. To do this, you will need to add another UIViewController and a button somewhere in your project.
**Just make sure to click the "push" segue as your segue type! Push segues can only be used when using UINavigationController and are the only segue that will give you a back button for free. If you select something like a modal segue, then the new screen will be presented with no way out! (for now). You can delete segues by clicking the circle on top of the arrow that links your View Controllers and pressing delete.
UINavigationController is a great and popular way to transition from screen to screen in iPhone applications. In fact, if you take out an iPhone right now and open up a few of your favorite apps, you will be guaranteed to see it! Look out for the navigation bar on the top of the screen.
Commenting is a great tool for summarizing procedures that might be difficult to understand upon first glance. A lot of the time, it might not be evident at first what a block of code does, and therefore a comment helps any readers of our code to understand what is being done. And readers include us too down the line! Many times after writing code, you will have to go back to it to maintain it or fix it, and well-commented code will be much easier to fix!
It is really good to get in the habit of commenting out your code. However, my commenting above was definitely over the top and maybe even called egregious. You don’t want to be commenting every line of code. With time, you will be able to find your perfect commenting balance.
For those of you who have gotten a taste of Objective-C before, this syntax (@"some text") is a convenient way of creating an NSString object. An NSString primary responsibility is to hold text. That’s all you need to know for now!
Woah... a lot of new stuff! Methods, class methods and conversions. Don't worry, we will get to exactly what all this stuff is shortly. But because we want you building applications now, we're including some rather simple examples of concepts you will see later.
Eliot regularly teaches iOS development classes and workshops at General Assembly and guest lectures for companies and development boot camps around NYC. He also taught the inaugural class for Coalition for Queens which focused on increasing diversity in iOS development. He also coaches students in a one-on-one environment with a focus on transitioning to full time development. Eliot cofounded and organizes the iOS Office Hours meetup NYC.
In his free time he works as a contractor for startups focusing on agile development.
Find me on twitter @EliotArntz - I check my direct messages quite frequently.
John was the lead iOS developer at Fast Society and Cameo until he started Bitfountain in 2012. The apps that John has contributed to have appeared in TechCrunch, Mashable and the New York Times. At Bitfountain, John oversees all projects from a technical and strategic perspective. At Bitfountain, John has taught over 120,000 students how to code online.