Write Code in the Source Editor
Perform Static Code Analysis
Use the static analyzer to find bugs in your code before you even run your app. The static analyzer tries out thousands of possible code paths in a few seconds, reporting potential bugs that might have remained hidden or bugs that might be nearly impossible to replicate. This process also identifies areas in your code that don’t follow recommended API usage, such as Foundation, UIKit, and AppKit idioms. To perform static code analysis, choose Product > Analyze. The Xcode static analyzer parses the project source code and identifies these types of problems:
- Logic flaws, such as accessing uninitialized variables and dereferencing null pointers
- Memory management flaws, such as leaking allocated memory
- Dead store (unused variable) flaws
- API usage flaws that result from not following the policies required by the frameworks and libraries the
project is using
Run Your App
Choose a Scheme to Build Your App
A scheme is a collection of settings that specify the targets to build for a project, the build configuration to use, and the executable environment to use when the product is launched. When you open an existing project (or create a new one), Xcode automatically creates a scheme for each target.
The default scheme is named after your project and includes settings to perform five actions:
- Run the app.
- Run unit tests against the target.
- Profile the app’s performance characteristics.
- Perform static analysis on the code.
- Archive the app for distribution, such as for sending to testers or submitting to the App Store.
Edit, Create, and Manage Schemes
You can edit a scheme so that it performs such actions as:
- Building multiple targets
- Executing scripts before or after any action
- Sending emails before or after any action
- Running with memory management diagnostics
- Producing either a debug or release build for any action,
Debug Your App
Control Execution and View State Information
Measure Your App’s Performance
The Instruments app, which is included with Xcode, gathers data from your running app and presents it in a graphical timeline.