Swift iOS 24-Hour Trainer. Mishra Abhishek
Чтение книги онлайн.
Читать онлайн книгу Swift iOS 24-Hour Trainer - Mishra Abhishek страница 8
The library area also provides a convenient method to access all the media files in your project. A selector bar at the top of the library area provides access to four different library categories.
The Debugger Area
The debugger area (Figure 2.20) also supplements the editor area. You can access it by selecting View
The debugger area is used while debugging an application and to access the debug console window. You can use this area to examine the values of variables in your programs.
The Toolbar
The Xcode toolbar (Figure 2.21) is located at the top of the workspace window. Use the first two buttons on the left side to run/stop the active build scheme. Immediately following the stop button is the Scheme/Target multi-selector. When you create an iOS project, Xcode creates a scheme with the same name as the project and several build targets.
The build targets that are typically generated for a project include:
• iOS Device
• iPad 2 (if it is an iPad or Universal project)
• iPad Air (if it is an iPad or Universal project)
• iPad Retina (if it is an iPad or Universal project)
• iPhone 4S (if it is an iPhone or Universal project)
• iPhone 5 (if it is an iPhone or Universal project)
• iPhone 5S (if it is an iPhone or Universal project)
• iPhone 6 Plus (if it is an iPhone or Universal project)
• iPhone 6 (if it is an iPhone or Universal project)
You can use the Scheme/Target multi-selector to switch build targets and create/edit schemes. Managing schemes is an advanced topic beyond the scope of this book.
To the right of the Scheme/Target multi-selector is a status window. Following the status window, the toolbar contains the editor selector and utility selector buttons, which have been covered in the previous sections.
Features of the iOS Simulator
When you run an application from the Xcode IDE, unless you have selected a device in the Scheme/Target multi-selector, your application will be launched in the iOS Simulator. Figure 2.22 shows the iPhone 5S simulator. You can use the iOS Simulator to simulate different device and SDK versions. To switch devices use the Hardware
You can rotate the simulator by using the Rotate Left or Rotate Right menu items from the Hardware menu. The iOS Simulator allows you to simulate a variety of one and two-finger multi-touch gestures. Single-finger gestures such as taps and swipes can be performed by clicking and dragging with the mouse. The only two-finger gesture that you can simulate is the pinch. To do so, hold down the Option key on your keyboard while clicking and dragging with the mouse in the simulator window. Shake gestures can be performed by using the Hardware
If you are developing an app that requires location data, you can use the iOS Simulator to simulate a test location while you are running your application within the simulator. Select Debug
The simulator can also simulate changing locations. This is particularly useful if your app is designed to be used while on the move. From the Debug
• Apple Stores
• City Bicycle Ride
• City Run
• Freeway Drive
Installing and Uninstalling Applications
To install an application to the iOS Simulator, you need to open its corresponding .xcodeproj file in Xcode and click the Run button in the Xcode toolbar.
You cannot delete the default iOS Simulator applications (such as Photos, Settings, Game Center, Safari, and so on). To uninstall (delete) one of your applications from the iOS Simulator, click and hold the mouse button down on the icon of the app until all the icons start to wiggle. Once they start to wiggle, you will notice an X button on the top-left corner of each icon.
Release the mouse button if you are still holding it down; the icons will still continue to wiggle. Click the X button on the icon of the app you want to delete. An alert window will appear asking you to confirm this action.
Limitations of the iOS Simulator
As good as the iOS Simulator may be, it has its limitations. For starters, you cannot make calls, send or receive text messages, or install apps from the App Store.
The performance of the iOS Simulator depends on the speed of your Mac, and in certain cases your application may appear to execute much faster on your Mac (in the iOS Simulator) than it does on the real device.
Accelerometer, camera, and microphone functions are not supported in the iOS Simulator. If you are developing OpenGL/ES-based applications, you should keep in mind that several OpenGL/ES functions are not supported on the iOS Simulator.
The iOS Simulator is a useful tool to test your apps but it is definitely not a replacement for testing on a real device.
Try It
In this Try It, you launch Xcode and open the project that you created in the Try It for Lesson 1. This project was built using the Single View Application template. Once the project is opened in Xcode, you will open a file in the editor area and display the assistant editor, debugger, and utilities areas.