Xcode

Xcode is Apple’s integrated development environment (IDE). You use Xcode to build apps for Apple products, including iPad, iPhone, Apple Watch, Apple TV, and Mac. Xcode provides tools to manage your entire development workflow—from creating your app to testing, optimizing, and submitting it to the App Store.

A project keeps the necessary files and resources for developing your app organized. To create a project, start with one of the templates, then modify it however you like. Templates are available for each platform (iOS, watchOS, tvOS, and macOS) and for common types of apps, frameworks, and libraries. Each template comes preconfigured with default settings and is ready to build and run. To see an interactive preview while laying out the interface and editing code, choose Swift as the programming language, and SwiftUI as the user interface.

image

After you create a project, the main window appears. This window is your primary interface for viewing, editing, and managing all the parts of your project. It's flexible and configurable, adapting to the needs of the task at hand and allowing you to configure it to fit your work style.

image

Use the navigator area (

image

) for quick access to different parts of your project. Click a button in the navigator bar to show the corresponding parts in the content area below the navigator bar.

image

For example, select a file that uses SwiftUI in the Project navigator (

image

) to open it in the source editor in the editor area, then click the Resume button on the right to start the preview. Xcode keeps the code on the left in sync with the interactive preview on the right. Use the controls in the canvas to run the app on a simulated device (with or without a debug session) or run the app on a connected device. A debug session opens in the debug area (

image

) below the editor area.

image

To use ready-made resources, click the Library button (+) in the toolbar, then select the type of resource to add. For example, select the Views library to access standard user interface elements. Drag the element you want from the library to the canvas or the source editor. Regardless of where you make the changes, Xcode keeps the preview and source code in sync.

image

Use the inspector area (

image

) to view and edit information for an object that you've selected in the navigator or editor area. To show an inspector, click the corresponding button in the inspector bar. For example, select a user interface element in the source editor or preview, then choose View > Inspectors > Show Attributes Inspector. Change the values in the inspector and Xcode updates the source code and the preview. You can also Command-click an element in the source code or preview to edit the attributes in a popover.

image

To see descriptions of the symbols, interface objects, and build settings you select in the editor area, click the Quick Help inspector (

image

) in the inspector bar, or choose View > Inspectors > Show Quick Help Inspector. To view the full documentation for a symbol, click the Open in Developer Documentation link at the bottom of the Quick Help inspector.

image

Alternatively, Option-click a symbol in the source editor (or Command-click the symbol, then choose Show Quick Help) to see a brief description of the symbol in a popover. To dismiss the popover, press Escape or click anywhere in the file.

image

Use the toolbar to build and run your app, view the progress of running tasks, and configure your work environment. You’ll choose a run destination—for example, a simulator or device—from the scheme menu. Use the segmented control located on the right of the toolbar to show and hide the navigator, debug, and inspector areas of the main window.

image

Select the project (the root file in the Project navigator) to open the project editor. Use this editor to view and edit your project and other settings. Use the tabs to switch between the different types of settings. For example, click Signing & Capabilities to provide information for code signing, needed to run on a device, and enable services provided by Apple.

image

你可能感兴趣的:(Xcode)