Header Ads

Get Familiar with Xcode

Xcode includes everything you need to create an app. It organizes all the files and resources that go into creating an app. It provides editors for both your code and your user interfaces. Also, Xcode lets you build, run, and debug your app—providing simulators for iOS devices and a powerful integrated debugger.
Take a few moments to familiarize yourself with the main sections of the Xcode workspace. You’ll use the areas identified in the window below throughout the lessons. Don’t be overwhelmed by all of the pieces; each area is described in more detail when you need to use it.

image: ../Art/BBUI_workspacewindow_callouts_2x.png

Run iOS Simulator

Because you based your project on an Xcode template, the basic app environment is automatically set up for you. Even though you haven’t written any code, you can build and run the Single View Application template without any additional configuration.
To build and run your app, use the iOS Simulator app that’s included in Xcode. The simulator gives you an idea of how your app would look and behave if it were running on a device.
The simulator can model a number of different types of hardware—All the screen sizes and resolutions for both iPad and iPhone—so you can simulate your app on every device you’re developing for. In this lesson, use the iPhone 7 option.
To run your app in the simulator
  1. In the Scheme pop-up menu in the Xcode toolbar, choose iPhone 7.
    The Scheme pop-up menu lets you choose which simulator or device you’d like to run your app on. Make sure you select the iPhone 7 Simulator, not an iOS device.
    image: ../Art/BBUI_schememenu_2x.png
  2. Click the Run button, located in the top-left corner of the Xcode toolbar.
    image: ../Art/BBUI_toolbar_2x.png
    Alternatively, choose Product > Run (or press Command-R).
    If you’re running an app for the first time, Xcode asks whether you’d like to enable developer mode on your Mac. Developer mode allows Xcode access to certain debugging features without requiring you to enter your password each time. Decide whether you’d like to enable developer mode and follow the prompts.
    image: ../Art/BBUI_developermode_2x.png
    If you choose not to enable developer mode, you may be asked for your password later on. These lessons assume developer mode is enabled.
  3. Watch the Xcode toolbar as the build process completes.
    Xcode displays messages about the build process in the activity viewer, which is in the middle of the toolbar.
After Xcode finishes building your project, the simulator starts automatically. It may take a few moments to start up the first time.
The simulator opens in the iPhone mode you specified and then launches your app. Initially, the simulator displays your app’s launch screen, and then it transitions to your app’s main interface. In an unmodified Single View Application template, the launch screen and the main interface are identical.
image: ../Art/BBUI_sim_blank_2x.png
Right now, the Single View Application template doesn’t do much—it just displays a white screen. Other templates have more complex behavior. It’s important to understand a template’s uses before you extend it to make your own app. Running your app in the simulator with no modifications is a good way to start developing that understanding.
Quit the simulator by choosing Simulator > Quit Simulator (or pressing Command-Q).

Tidak ada komentar

Diberdayakan oleh Blogger.