Simple use of Workspace and associated use between multiple projects
Effect: Manage multiple projects simultaneously
Create a Workspace
- Create a folder on your desktop and name it
MyWorkspace
- Open Xcode and select File->New->Workspace…
- create
Workspace
The nameMyWorkspace
, deposit toMyWorkspace folder
In the
- Open the
MyWorkspace.xcworkspace
2. Manage Project
- Two ways to add a Project to a Workspace
1. Create Project and add it to Workspace when you select the repository
- Create a Project
- Select the App
- Named TestA
- Added to the
MyWorkspace folder
“, and selectAdd to: MyWorkspace
- This will create the
TestA
Added to theMyWorkspace
In the
2. Add the created Project to the Workspace
- in
MyWorkspace folder
Create Project and name itTestB
- Open the
MyWorkspace.xcworkspace
- choose
File->Add Files to "MyWorkspace"...
- Select from “TestB Folder”
TestB.xcodeproj
- In this way, we can take
TestB
Added to theMyWorkspace
In the
Create the Framework and add it to Workspace
1. Create MyFramework
- choose
File->New->Project
And then select Framework
- Create the Framework and name it
MyFramework
In the first way, add toMyWorkspace
In the
- Create it in MyWorkspace
Person
Class, and implements class methods+run
- MyFramework Project->Build Phases->Headers
Person
The default inProject
In the
- If you want to access it from the outside
Person
, you need toPerson
Move to thePublic
In the
- in
MyFramework.h
In the importPerson
Use MyFramework in TestA
- Go to TestA’s Project->General->Frameworks, Libraries, and Embedded Content
- add
MyFramework
- In TestA you can import
#import <MyFramework/MyFramework.h>
useMyFramework
- You can also import it directly
Person
Static library
Create a static library and add it toMyWorkspace
- through
File->New->Project
Create a static library namedMySDK
And add toMyWorkspace
In the
2. Use static libraries
- add
say
methods
- Select the compilation environment as
Release
command + B
Compile, generate
- Right click,
Show in Finder
You can see the.a file of the generated simulator environment
- You can choose the real environment and compile
- Right click on the
Show in Finder
And you can see the generated.a
file
Debug static libraries in TestA
- Drag the corresponding. A file into TestA, depending on the environment you are debugging (emulator or real)
- In TestA, you can use it directly
MySDK
- You can go directly to
MySDK
Use breakpoint debugging in