If you’re fairly new to Apple Development or it’s been a while since your last year’s Xcode. Let’s take a couple of minutes to go over the basics. We will spend most of our time here. Xcode is our IDE or Integrated Development Environment like Visual Studio or Eclipse or Aptana. And being an IDE just means it does more than one thing. We don’t just write our code in X code, we design our user interfaces here. We compile our applications here. We use it to test and debug. We use it to browse documentation and find help, but at its core, Xcode is here to organize all the files in our application, and it groups them together into projects, as we’ve seen.
Projects are just a way of collecting a bunch of files together and giving them a name. And when you create a new project in Xcode, either from the welcome screen or by saying File > New > Project, we get our selection of templates. Now, Xcode has a lot of templates, although, in this post, we are almost always interested in the iOS mobile app development. Once again, I’m just going to create a Single View Application. We’ll get into the others later. And give this one a simple name. And as I mentioned earlier, I don’t use spaces in my product names, so I’ll call this one DemoXcode.
It’s going to ask me for all the same naming info, but the organization name and company identify it will keep from the last time. Coming down, I’ll make sure that the device is set to iPhone. Click Next, and tell it where to save it. I’m just going to save this DemoXcode project to my desktop. So the project is now created, but before we go exploring within Xcode, I’m going to go and take a quick look at what was created when we did them. So here’s the folder that we got DemoXcode. If I go into that and I’m just going to change it so we can view it a little better.
We’ll see that Xcode gave us quite a few different things here. But what you might see is that some of them match what I see in Xcode itself and some of them don’t. If I expand the folders in Xcode, I can see that I have a main.m. If I look in my finder, I can also see that I have a main.m. But the folders that I see in Xcode don’t exactly match the ones I see in a finder like I have got a supporting files folder in Xcode that doesn’t seem to exist over here in the finder. Don’t worry too much about that.
Xcode allows us more ways of grouping these files than the actual folders on the drive. However, there is one important one that I’ll see in Finder. One very useful is the DemoXcode.xcodeproj or Xcode project file. This is the file that contains all the settings for this particular project. And if Xcode was closed, double-clicking this would be the quickest way to open up Xcode with all these project files loaded. Okay, so let’s talk about the best way around the Xcode 5 interface. We are of course in a programming environment so everything is oriented around this editing section in the middle.
Whether that’s letting us edit code or letting us edit a user interface. Now the toolbar up at the top, as you’ve no doubt guessed, let’s you run the application. We’ve got the play and stop buttons. This central section here, that looks like a small LCD display, will show messages about anything that Xcode is doing as we work on our project. It’s a little like how iTunes displays messages when you’re copying or syncing. Over on the top right, you should have two groups of three buttons. Right now in the first group, we’ve got the first one highlighted. This means we’re using what’s called the standard editor.
There are different ways to edit your code files and your user interface files, but we’ll see these other ones later. In the second section, we have these three separate buttons, dock left section, a dock bottom section, dock right. All these buttons do is toggle the different areas of Xcode on and off. Now unlike some other applications, in Xcode, you do not and cannot rearrange or detach or drag and drop panes from one area to another. This is an Apple mobile app development environment, the layout is the layout. So this section on the left stays on the left.
You can choose to make it visible or not but that’s the only options that you have with it. And this left-hand section over here is called the navigator. The navigator is the way to navigate, to get around everything in and everything about the project. All my files, all my settings, all my different options. I can expand folders, and by single-clicking I can focus on a single code file. If I wanted to double-click that it would open up in a separate window. Most of the time in this course, I’ll just be single-clicking the files. Now, this left section actually contains eight different navigators, each with these buttons along the top here.
You can move between them by clicking the buttons. At the moment, with a simple project like this, there’s not much to see apart from in that first section. But you will be able to view things like issues and log messages using these. Sometimes Xcode will switch you to a different navigator section if useful. But you don’t need to memorize them all, right now. The most important navigator is the first one, the project navigator, the one that looks like a folder. A useful shortcut for this is Cmd+1, even if you have that section closed, hitting Cmd+1 will open it back up again.
This is a view, not just of all the files in your project and things that you can switch between, but also the project settings, itself. Clicking this very top icon, here, with the name of the project, will let us view the top level settings, and not just work on one single file in the project. And we’ll get more into this a little later on. But the same as the left-hand side can be turned on and off, so can the right-hand side. And this side contains two separate parts, the inspectors at the top, and some libraries in the bottom section. Now the arrangement here is not random, there is a point to the whole overall layout of Xcode.
We can think of the navigators on the left as shown, everything about the project, as the central section, is showing, the one thing that I’m working on, and then the inspectors on the right are context sensitive. Like many IDE’s these change based on the one file that I’m working on or whatever I have selected. So with one of these highlighted I can see that it actually shifts as I click around to different files in that section. Like the navigators, there are different sections to the inspectors that can be highlighted with these buttons up at the top.
But these change a little bit, if I clicked on a code file, I’ll typically see two different sections to it. If I’m editing an iOS user interface, I’ll typically see eight different sections of it. Once again, don’t worry too much right now about memorizing these, we will explore all of them as we go. Now the libraries below in the lower section here are really the simplest. These really do not change based on what I have selected, they’re always the same. Libraries contain collections of things you might want to add to your projects, like a library of user interface elements in theobject library or a library of code snippets.
Things here can be dragged and dropped into the project or into code files. Now Xcode, like most other IDEs has preferences. Things that you can customize this application to make it work better for you. I’ve made two small changes to it just to make my code easier to read. I’ve increased the size of the code font and I’ve added line numbers to it. If you wanted to add those yourself you would just find it in the Preference section. Fonts and Colors allow me to select from different themes. I’ve just selected the Presentation one.
The only other option I’ve changed is in the Text Editing section. I’ve turned on Line numbers so they show up here when I’m talking about certain lines of code during the course. Now when we’re editing text in Xcode, like most modern IDEs, we will get an automatic indentation. We’ll get color coding of the different pieces of syntax, showing the difference between comments here in green, keywords, and class names and so on. We also get code sense which is Xcode’s auto-completion feature. If I start typing and I’ll start typing, say the letters UI, I’ll get this pop-up appear, I can use the cursor keys to move up and down and just hit Return for anything that I’d like to select.
And that helps us a lot because there are a lot of long names for objective C classes and methods in iOS app development. Now notice I already have this exclamation mark appearing on the left-hand side here. That’s because Xcode does try to highlight issues with your code as you’re typing it, and it’s often quite quick about this. You haven’t even finished a line before it starts complaining about it, so you will see that a lot. I don’t actually need that line of code. So I’m just going to go ahead and delete it. Now there is a lot more to Xcode, options, to connect to, source control repositories, debugging, performance tools, code snippets ways to help you manage your projects.
About Boston Technology Corporation – iOS App Development Company
We are a top iOS mobile app development company based in Boston. With strong experience in Technology and Design, Enterprises have hugely benefited by leveraging our mobile app development services. Our core mobility services
IoT and Wearable’s
For more information, visit our website http://www.boston-technology.com/ or drop a mail at firstname.lastname@example.org.Tags: android app development Enterprise mobile app development iOS app development mobile app development