Interested in Monster iOS: A New Beginning but want to take a look first? Great! We’ve got the introduction and first chapter available for you to look at.
Monsters’ First Project
“OK …” said Dave. He wondered if he should mention that he hadn’t had breakfast yet. He decided against it since any mention of food might result in the monsters’ thoughts drifting in a direction that wasn’t going to be healthy. For him. He wondered if humans were considered a healthy snack. Maybe monster stores had packets of human chips? He tried to push his mind away from such thoughts and concentrate on the matter at hand.
“Where would you like to start?”
“Well, we’ve used many iOS apps. That’s a start, right?” Wendy asked. Dave wasn’t sure if she was serious. It was hard to judge expression on a face which mostly showed fangs.
“But do you know anything about programming?”
The others looked as blank as a schoolboy faced with a pop-quiz after a night of hitting the pillows rather than the books.
“Hmm … since you do have access to the Internet, did you guys take a look at the Apple developer documentation? They provide a lot of useful info …” asked Dave, trying again.
“We tried, but all of that seems like a lot of gobbledegook! Lots of tech jargon. We need somebody to explain stuff to us!” snapped Wendy.
“How about the Stanford CS193p online lectures?”
“Too fast. They assume you already know a bit about programming.” Zane volleyed back.
“I guess I could start by explaining Objective-C and all the different programming concepts to you …” tried Dave.
“Whaf’s Objecfive-C?” asked Vincent.
“Objective-C is the computer language used to create iOS applications.”
“Are there other computer languages you can use to develop for iOS?” asked Wendy.
“Yep. But Objective-C is the one used by Apple,” explained Dave.
“Buf would fhaf allow us fo creafe an app immediafely?” asked Vincent, looking hopeful.
“No, I’d have to tell you about Objective-C, the different data types, the command structures, then explain Xcode, how you create an app …”
“Xcode?” asked Vincent.
“Xcode is the development environment used to create an iOS application. Like how you’d use an axe to cut a tree, Xcode is the tool that you need to use to develop an iOS application. There are other similar tools, but Xcode is the one that Apple uses. It’s also called an IDE, or an Integrated Development Environment, meaning that all the tools you need for development are there in one package …”
“I don’t think we like learning all about the language,” interrupted Zane. “Can’t you show us how to create a simple program and then explain about Objective-C as we move along?”
Dave thought about it for a moment. “Yes, I think that’ll work. But I’ll have to teach you a bit about Xcode to begin with though …”
“But it’ll be faster than learning all about data types and stuff?” Zane persisted.
“OK, then that’s the way to go! Teach us all about Xcode!” said Zane, looking almost alive in his enthusiasm. (“Heh, alive! I see what you did there,” inner-Dave whispered. Dave ignored him.)
“Umm … do you guys have a Mac I can use?” asked Dave, wondering how big their computers were going to be.
“Yes, it’s in the next room. We housed you here because of that,” replied Wendy.
Dave got up from the bed, feeling slightly vulnerable. “Lead on, then!” he said brightly, trying to stop the screaming in the inner caverns of his mind.
The computer was big. In computer terms, it might even have qualified as huge. It took up about half the room. But on the positive side, the monitor was so huge that it stretched from floor to ceiling. Dave couldn’t help but smile thinking of the look on his coder friends’ face if they saw how huge his monitor was. He turned to the monsters hovering behind him.
“OK, then. Get settled in. It’ll take a little while to download Xcode from the Apple developer site.” A thought struck him. “How fast is your Internet anyway?”
“Nobody knows. The scientists say that there’s some unexplained phenomena surrounding the wormhole and that everything transfers instantaneously, no matter how big the download,” replied Zane.
Dave wondered whether Zane was the egghead of the bunch. Of course, this led to another thought as to how many brains Zane might have eaten to get so … umm … brainy.
“Well, that’s handy. So let me go to the Apple site and get Xcode. Any of you have an Apple Developer account?”
“That’s the other thing,” replied Wendy. “We don’t have credit cards to get an Apple Developer account. The nobs manage to do it somehow but we don’t know how …”
“But you know you can sign up for a free developer account on the Apple site and then download Xcode at no charge, right?” asked Dave.
“Yes, but then we can’t test on device. At least, that’s what they say on the site,” answered Wendy, sounding exasperated.
“Yes, that’s true, ” replied Dave nodding his head. “OK, I’ll login with my account and get the iOS SDK and Xcode downloaded,” he said as he started a web browser, went to the Apple site, and logged in. The Internet access was indeed remarkably fast. Almost magical in how everything loaded instantly with no delays whatsoever. He clicked on the download link for the SDK and it was done downloading by the time he finished tapping on the link.
“Wow, that is fast!” said Dave, impressed.
“Told you!” cackled Zane. It wasn’t a pleasant sound. Dave tried to keep himself from shuddering.
Vincent seemed to be struggling with something. “Whaf’s an SDK?” he asked.
“SDK is an acronym for Software Development Kit. It’s just a set of tools which allow you to develop something, in this case iOS apps. Programmers use the term to indicate anything ranging from a full set of tools like Xcode and the accompanying documentation and other code or it could simply be a few sample code files or just the code needed to get a particular task done. The iOS SDK is fairly large since it contains everything you need to develop, debug, and distribute applications for the iOS platform.”
“Since it’s so large, is installation of the SDK difficult?” asked Wendy.
“Since Xcode has to be installed via the Mac App Store, there’s really nothing much for you to do. Once it downloads and installs, you’re ready to go,” said Dave, trying to keep his mind (and the minds of his audience) busy. He just didn’t want to deal with the horrors surrounding him. (“Run away!” inner-Dave whispered.)
“Can we develop an app now?” asked Vincent.
“Well, you can. But first you should learn a little bit about Xcode and how to use it. Otherwise, when I say something like ‘Go to the Project Navigator’, you might not know where it is – a good craftsman always knows his tools” said Dave, trying to sound reasonable and wise and stuff. (“But really, you’re just shaking in your boots!” said inner-Dave, butting in again.)
“Good poinf,” nodded Vincent.
“OK, so you start Xcode and after accepting the license agreement and stuff, this is what you’ll see,” said Dave, pointing at the screen.
“That’s it? I expected something a little bit bigger,” said Wendy.
“That’s just the start screen,” Dave hastened to explain. “If you had worked on any projects before, they’d be listed on this screen. See that column which says ‘No Recent Projects’? That’s where your recent projects would appear. And you can simply select a project from there and work on it …”
“But how does Xcode know what projects we were working on? Is it telepathic?” asked Zane, his eyes expanding to cover most of his shriveled skull.
“Well, a project is a type of document under Xcode which holds all the necessary files for your current umm … project. Each project file would be the computer equivalent of a project, or job, that you wanted to work on. Makes sense?”
“Kinda …. Buf fhey should have picked some ofher word besides projecf for fhe documenf. Now we have our projecf and fhen fhere’s fhe Xcode projecf. Confusing, no?”
Dave stared at Vincent for a second, trying to make sense of what he’d said. He forbore from making any comments about how much more confusing vampire speech was. Instead, he said: “Well, I guess it is confusing, but once you start working with Xcode, you’ll get used to it.”
“So we click on Create a new Xcode project to create a project?” asked Wendy.
“Duh!” was Zane’s response. Wendy gave him a look which made Zane clamp his mouth tight. (“I wonder what dirt she’s got on him? Maybe he doesn’t eat brains and the other zombies will make fun of him if they knew!” inner-Dave mused.)
“Yep,” was Dave’s only response as he wondered what the safest exit route was, should a fight break out between his students.
“So what does Check out an existing project do?” That was Wendy again.
“That gets a project from source control ….”
“Source control is a way for you to save different versions of your code, over time, as you make changes to your project …”
“A backup plan?” Zane interrupted.
“Yes, you can use it as a back up plan too. I often save a version of my code to source control just before I make any major changes.”
“So how do we set up source control?”
“Well, that could get a bit tricky to explain. You have several different source control mechanisms like Git, Subversion, Mercurial … If I were to try to explain how all of them work, it would take a lot of time. Plus, that’ll take us away from learning about iOS development.”
“So we’re not going to learn about it?” demanded Wendy.
Dave wondered whether there had been an edge to Wendy voice. “No, no. We’ll cover it,” he said hastily. “But we’ll cover it in context of how Xcode does source control. But since that’s down the line, we’ll first start with a normal project …”
“Select Create a new Xcode project then?” asked Zane cheerfully.
“Yes, and when you do that, you get this,” said Dave, gesturing at the screen like a magician revealing his latest trick.
“Uh oh, choices, lofs of choices,” said Vincent, looking as if he was about to start wringing his hands.
“Don’t get overwhelmed. It’s pretty simple,” said Dave, in what he hoped was a soothing voice. “See, this dialog is basically three sections: this panel on the left which lets you select a category of items, this top pane on the right for items matching a category selected from the left panel …”
“And the bottom section simply describes the currently selected item in the top panel,” said Zane, sounding smug.
“Yes,” said Dave, slightly annoyed at the interruption to his flow of words.
“So what do we select here?” asked Wendy.
“That depends on what you want to do. See, the left panel lets you choose between creating an iOS app or a Mac app. I assume you guys want to do iOS apps?”
“Yes,” said all three, almost in unison.
“OK, so we’re only interested in the section marked iOS. And there, you have three options, as you can see. But since you want an app, our choice is made for us.”
“But what about the other choices?” asked Zane.
“Well, those options are for more advanced types of projects. We can get into that later if you want. But it’s best to get started with a simple application first.”
“OK, so since we are going with the already selected item on the left panel, is Master-Detail Application what we need from the right panel?” asked Wendy.
“Well … you could go with that but that template is a little complicated. You’re probably better off going with the simplest template …” began Dave.
“Whaf’s a femplafe?” asked Vincent.
“Think of a template as a starter project which has already been created for you by Xcode. A template will have the necessary components in place for a specific task. For example, the first template, Master-Detail Application, has enough code to create a master-detail application without you having to write a lot of code …”
Dave saw Vincent opening his mouth and hastened to add, “And before you ask, a master-detail application is a type of application where you have a main screen with a list of items, say a list of names, and where you can select one item from the list to see another screen with the details for that item. For example, more information about the person who’s name you selected …”
“Like where fhey live and whaf fheir blood fype is,” supplied Vincent.
Dave thought that there was just a tad too much enthusiasm in Vincent’s voice. But he decided it was best to ignore him. “Yes, something like that,” he agreed. “But for your first app, we’ll select Single View Application since that template gives you a completely working application with a simple structure.”
Dave selected the template as he spoke and then tapped the Next button. “And that gives you this next screen.”
“When do we gef fo fhe applicafion?” asked Vincent plaintively.
“Soon, we’re almost there,” answered Dave reassuringly. “We just have to complete this screen and we’re there.”
“What do we add in here?” asked Wendy.
“This is mostly identification information. You can give any name for the product and the organization names. Not really a problem if you’re just doing an app for fun. If you want to sell an app on the App Store, then you have to worry about the name since you can’t use an existing name. But you don’t have to worry about that …”
“Why not?” asked Zane.
“Well, this is just a name you add to start off. You can change it later if you want. The organization name just appears at the top of your source code for the copyright info,” he held up a hand, “Before you ask, I’ll show you the copyright info after we create the project.”
“What about Company Identifier?” asked Wendy.
“Now that’s a bit more important. Take a look at the Bundle Identifier below the Company Identifier …”
“But we can’f change if!” said Vincent.
“Yes, because the Bundle Identifier is automatically created based on the Company Identifier and the Product Name. And the Bundle Identifier has to be unique because that’s how each application is identified on the App Store.”
“How do you ensure that the Bundle Identifier is unique?” asked Zane.
“Well, that’s where the Company Identifier comes in. You usually set the Company Identifier using reverse domain notation ….”
“What’s that?” asked Wendy.
“See how the Bundle Identifier example is set currently? If the domain name for your website is yourcompany.com, the reverse notation would be com.yourcompany”
“Ah, I see,” said Wendy.
“Since your domain should be unique for you or your company, the combination of the domain name and the product name should ensure that your Bundle Identifier is unique. Get it?”
“Yeah, yeah. Lef’s move on!” said Vincent.
“Hang on! What’re the other values and what do you set them to?” asked Wendy.
“Class Prefix is just a string of characters that’s added to the beginning of class names so that classes will be unique.”
“Why should our classes be unique?” asked Zane.
“And whaf are classes?” asked Vincent.
“I’ll get to classes soon, Vincent. As far as why they should be unique, normally, it doesn’t matter much and people mostly don’t set up the class prefix. But say you use somebody else’s library and they have a class called MyClass and you have a class called MyClass, the compiler won’t know which MyClass you’re referring to …”
“Use somebody’s library? You mean like borrow a book from them?” asked Wendy, beetling her thick brows.
Dave almost snickered but re-considered just in time. “Sorry, I should explain better. For iOS projects, you can use code written by other people to make your work easier …”
“Like copying from somebody af an exam?”
“Well, not quite. This is more like borrowing somebody’s van to move stuff. Instead of buying a van, or in this case, writing the code yourself, you use somebody else’s code to make your life easier.”
He was met by blank stares. “OK, perhaps we can cover libraries later and this’ll make better sense. But for the time being, just remember that you can add a Class Prefix if you want your classes to be uniquely named.”
“But what do we set as the value for class prefix?” asked Wendy.
“Why don’t we fill in the first few values quickly?” replied Dave. “What do you want to name your first app?”
“Snack Lisf”, said Vincent.
“Brain Types,” replied Zane.
“Moon Cycles,” growled Wendy.
“Umm, how about Sample App?” asked Dave.
The others grumbled a bit but agreed.
“Are we going to keep Organization Name set to your name?” asked Zane.
“No, you can set it to anything you want. How about Monsters Inc?” asked Dave brightly. The others gave it some consideration and seemed to like it. So Dave changed it quickly before they started bickering over a different name.
“Do you guys have a website?” asked Dave, knowing the answers.
“No. Do we need one to set this up?” asked Wendy.
“Nope. We can set the Company Identifier value to anything. We’ll imagine that your website URL is monsters.inc and so the reverse domain name would be?”
“inc.monsters!” said Zane quickly, while the other two glowered at him.
Dave typed that in. Then said, “OK, that leaves us with the last two text boxes. You know what Class Prefix does. You can set the prefix to something long like MonstersInc but then all of your class names will be really long – like MonstersIncMyClass. Most people go with two or three letter combinations …”
“Whaf kind of combinafions?”
“Well, people usually take the first letters describing the app or their company or something like that. For instance, since the app name is Sample App, your prefix can be SA. Or you can set it to MI for Monsters Inc.”
“That sounds good, let’s go with MI,” said Wendy.
“But … Apple uses class prefixes for their code too and since all their class prefixes are two letters, they suggest that people go with three letters so as to avoid any conflicts. Of course, they don’t currently have any classes with an MI prefix but they do have one with a MIDI prefix …”
“Isn’t that four letters?” asked Zane.
“Yeah, go figure. I guess not even Apple sticks to their own rules. Not that this is a rule, mind you …”
“Do we use MI or don’f we?” asked Vincent, sounding irritated.
“We can, but I think to be safe we’d best go with MIA for Monsters Inc. App,” said Dave and entered that.
“OK, almosf done. Whaf is Devices?” asked Vincent.
“That is where you specify whether your app will be iPhone only, iPad only or if you want it to run on all iOS devices. See?” said Dave showing the drop-down for the Device value.
“Ah,” said Wendy, nodding her head. “We want a Universal app, don’t we?”
“Do you guys have iPads?”
“The nobs have them. They’re a bit too expensive and new for the normal folk,” said Zane, almost spitting out the words as if they left a bad taste in his mouth.
“And if you create any apps, since they have the money, that’s probably where you’d make the most sales. So I’d definitely say go for universal,” said Dave.
The others seemed to like this a lot and they nodded enthusiastically. Dave set the drop-down to Universal and tapped the ‘Next’ button.
“Aaargh, anofher screen! You said we’d be done!” grumbled Vincent.
“We’re almost there. This is just to save the project. So we’re technically done with setting up the project,” said Dave soothingly. “See the Source Control section at the bottom? That’s how you add your project to source control when you create it. You can uncheck the box to not have Xcode create a source code repository for you. And as you’ll notice, it creates a source repo using Git …”
“Whaf’s a repo?” asked Vincent.
“It’s short for repository. Can’t keep saying repository all the time, that’s too much of a mouthful,” said Dave, smiling. (“Don’t mention mouthfuls! You’re probably a mouthful to him!” warned inner-Dave.)
“Where do you save the project? Does it have to be in a particular location?” asked Wendy.
“Nope. You can save it anywhere you want on the hard disk. I’ll put it under Documents, click Create, and we’re done!”
“Woah, lofs of new ifems!” said Vincent, scrunching up his eyes and staring at the screen.
“Welcome to the main Xcode window,” said Dave. “This is where your Xcode adventure really begins!”
 iOS Developer Library: This is Apple’s online documentation providing access to the iOS documentation, API references, and sample code. It is freely accessible by anybody with Internet access. http://developer.apple.com/library/ios/navigation/
 Stanford CS193p Course: This is a series of lectures from a course taught at Stanford University that is available via iTunesU. You will not get any support from Stanford staff, but you will have access to the source code, example projects, and the lecture videos. http://www.stanford.edu/class/cs193p/cgi-bin/drupal/
 Programming with Objective-C: This section of the Apple Developer documentation describes the Objective-C language concepts in detail. http://developer.apple.com/library/ios/documentation/cocoa/Conceptual/OOP_ObjC/OOP_ObjC.pdf
 Apple Developer Site: You can sign up for free at the Apple Developer site to download the latest Xcode and the iOS SDK. https://developer.apple.com/devcenter/ios/index.action
If you want to test your iOS applications on device, distribute your application via the Apple App Store, or want to have access to the latest beta SDKs, then you must sign up for a paid developer account.
Take a look at the rest of Monster iOS: A New Beginning.