First, create a new project
1. The first step is to open Xcode, locate the Xcode program icon and click
2. The following interface, we click on a new project, that is, the second item
(1), Get started with a playground
Playground was Apple's 2014 WWDC (Apple Developers Conference) with Swift, a tool that could be used to write code and generally preview the effect of the code in real time.
Equivalent to the previous write code to go through Build-->run long wait to see the effect of the code, playground to the convenience of programmers self-evident.
Playground The shortcomings are: can not directly use the playground file directly to the project, temporarily does not support objective-c.
We developers can use playground to quickly test some code and effects.
(2), creat a new Xcode project
Create a new Xcode project that starts with this option for a general formal project.
(3), Check out an existing project
Open a project that already exists
3. Select a project template to create, as below, the diagram has been marked different, and click Next
Left column:
The four categories in the left column represent mobile phone/pad, watches, TVs, and PC-side development options, which is a xcode that can develop all the software in all of Apple's product lines.
Application: That is, create a complete project.
Framework & Library: Write a framework or libraries
Right detail:
A variety of predefined templates that show the styles of the various templates, in general the project chooses the simplest, or third, template.
4. Fill in and select the information for the created project as follows and click Next
(1) Product Name
The name of the project, such as the name in this example, is xcodeintroduction (Camel-named)
(2) Organization Name
Name of organization or company
(3) Organization Idetifer
Identification of the organization or name
(4) Bundle identifer
Package identity, the new project is automatically generated based on the name of the project you created, and can be modified internally.
(5) Language
Development language selection, currently Xcode provides object-c, swift two choices, here choose OC.
(6) User Core Data
Whether to use Coredata,ios to develop a common database.
(7) Include Unit Tests
Whether to add Module unit test target
(8) Include UI Tests
Whether to add a UI unit test target
5. Select the path to create the project, as below, select Desktop, and click Create.
(1), creat Git repository on my Mac
If you create a version control system, you can choose whether to create a local or a server. The version control system, or the modification of the control system, is actually a way to detect changes in the source file and save it for later reference using the mechanism (software). In addition, it can record other swimming information, such as which developer changed the code, when it was modified, which part was modified, and other historical information. The version control system can compare different versions of the code and, if necessary, restore the entire project to a previous version, tracing harmful code and thereby reducing product errors.
With a version control system, developers can work on different branches of a project, and when each part of the project is developed, they are put together to form a final version, a process called merging. In fact, this practice is quite common in teams and software companies: everyone is responsible for part of the project, and ultimately all parts are integrated into the final product.
6, after the successful creation of the interface as follows
Second, the Xcode interface detailed introduction
Five regional presentations, such as
1, the first part: The top of the area
(1) Program operation Related:
From left to right: Run button, stop button, select Run Platform for project.
(2) Editor-Related:
From left to right: standard editor, Secondary editor, version editor.
(3) Panel control Related:
From left to right: Hide (show) left panel, hide (show) bottom panel, hide (show) right panel.
2. Part Two: left panel
The panel is the Xcode engineering navigation panel, with eight buttons above to toggle navigation mode. From left to right: project navigation, symbolic navigation, search navigation, problem navigation, test navigation, debug navigation, breakpoint navigation, log navigation.
(1) Project navigation
Project navigation consists of:
Source files: the ". H" and ". M" suffix files in the Xcodeintroduction directory are source files;
Properties file: In the xcodeintroduction under the supporting files directory is a property file picture, etc.;
Unit test Project: Xcodeintroductiontests, xcodeintroductionuitests is engineering unit test project;
Target application: The Xcodeintroductiontests.app in the products directory is the target application.
(2) Symbol navigation
Introduction to Symbolic Navigation: Displays the classes, items, and attributes in the project with symbols;
Representation Method: C represents a class, M represents a method, p represents a property
Quick positioning: Click on the corresponding method or property to quickly navigate to this class.
(3) Search navigation
Enter the string you want to search for in the search box, and press ENTER to search for the class that contains the string.
(4) Problem navigation
Displays warnings or errors that exist in the project
(5) Test navigation
Click the Execute button behind Testexample to run the unit test;
(6) Debug button
Detailed information about each county is displayed in the debug navigation panel.
(7) Breakpoint navigation
List all breakpoints for easy management of breakpoints
(8) Log navigation
Lists the build, build, and run processes during the project development process, which can be viewed through the log panel each time.
3. Part III: DEBUG panel
Used for Xcode display console debug output information.
(1) Add breakpoint
For example, add a breakpoint on line 20th to print the code.
(2) Start debugging (automatic judgment)
Click the Debug button in the top panel, if the code has a breakpoint, it will automatically enter the debugging state, execution to the breakpoint will automatically stop, detailed debugging information displayed in the bottom of the debug output panel;
(3) Debug Panel button Introduction (red box from left to right)
1.continue program execution: Continue to execute the following code;
2.step over: One-step debugging, click the button once, execute a line of code, if there is a method call, will not enter the method;
3.strip in: Step into the Debug, click the button, will enter the method
4.SETP out: Step out debugging, in the method, click on the button, will exit the method, the execution of one step outside the method of debugging;
5. Click to see the view hierarchy for this project
6. Click will let you choose your location
4. Part Four: Right panel
Includes two sections on the side of the Inspector panel and the lower side of the library panel.
(1) Inspector panel
Inspector Panel Categories:
Common source files: Include File Checker and quick Helper.
1) File Checker
Identity and Type:file name (filename), file type, full path (path)
Text setting:text Encoding (file encoding using character set), Indent using (indent), wrap lines (Wrap)
2) Quick Helper
Interface Design Related checker
When the user selects the file ". Storyboard" or ". Xib" suffix, additional four inspectors will be found;
3) Identity Checker
Management interface Component Class implementation class, restore ID and other identity attributes;
4) Property Inspector
Manage interface component stretching method, background color and other properties;
5) Size Checker
Management interface components wide height XY axis coordinates and other properties
6) Connection Checker
The relationship between the management interface component and the program code;
(2) Library panel (from left to right)
The various library files of the project, easy to find using
1) File Template Library
Manage file templates, you can quickly create a specified type of file, can be dragged directly into the project;
2) Code Snippets Library
Manages a variety of code snippets that can be dragged directly into the source code
3) Object Library
interface components that can be dragged directly into the storyboard
4) Media Library
Manage all kinds of pictures, audio and other multimedia resources
5. Part V: detailed coding Area
This area is the main area of code writing.
Three, the Xcode menu detailed
Iv. introduction of Xcode shortcut keys
The shortcuts in Xcode are really confusing, but here are just a few shortcuts to buttons on the main interface (with strong memory rules), code-related, run-related code to see here
1, the first need to know is the area of Xcode and modifier key relationship, the following is a quick tour
Command: To navigate, control the navigation area
ALT: Control Something on the right, such as assistant editor,utility Editor
Control: Edit some of the jump bar interactions on the area
Such as
The following are the most commonly used key combinations:
Command 1~ 8: Jump to different locations in the navigation area
Command 0: Show/Hide Navigation area
Command Alt 1~ 6: Jump between different detectors
Command Alt 0: Show/close the tool area.
Control Command Alt 1~4: Jump between different libraries
Control 1~ 6: Jumps on different tabs of the jump bar.
The last and simplest is the return key, which, when combined with command, allows you to switch back and forth between different editors in Xcode.
Command + Enter: Display standard Single Window editor
Command Alt Enter: You can guess what it does, its function is to open the Assistant editor
Command Alt Shift Enter: Open version Control editor
It is also important to show/hide the debug area shortcut key is Command + Shift + Y, to remember this you can use this phrase to memorize "Y is my code not working?" (Translator Note: Y homophonic why).
If you forget some shortcut keys, you can find most of the shortcuts in the Navigate menu bar of Xcode. At the end of this part of the study, you will be surprised to find that you just use the keyboard to make Xcode the various changes.
[Hmly]6.ios Xcode full anatomy