How To Create Xcode Workspace And Add New / Exist Project Into It

Xcode use workspace and project to manage swift source code. When you develop an iOS app, you should first create a workspace, and then create and add new project into it. You can also add exist project into Xcode workspace. This article will tell you how to do it.

1. How To Create Xcode Workspace.

  1. Launch Xcode tool, click File —> New —> Workspace menu item at Xcode top menu bar to open a popup dialog window.
    xcode file new workspace menu item
  2. Input a workspace name and select a saved directory in the popup dialog window, then click Save button. After that it will create a workspace file with file extension .xcworkspace like below. The example workspace name is iOSExampleWorkSpace.
    xcode workspace file example

2. How To Add New Xcode Project Into Workspace.

2.1 Open Xcode Workspace File In Xcode Tool First.

Before create new Xcode project, you should first make sure the Xcode workspace has been opened in Xcode tool follow below steps.

  1. Launch Xcode, click File —> Open menu item at Xcode top menu bar. Browse and select the Xcode workspace file you just created in section 1. Now you will find there is nothing in the Xcode workspace. If you do not close or exit Xcode after create workspace in section 1, you will see below Xcode window directly.
    open a workspace file in xcode only

2.2 Add New Xcode Project Into Workspace When Create It.

  1. Click File —> New —> Project menu item in Xcode top menu bar.
    xcode file new project menu item
  2. Select an iOS app template in the popup dialog window, click Next button.
  3. Input Xcode product name and choose coding language ( swift ) in next wizard dialog, then click Next button.
  4. Select the workspace name in the Add to drop down list, click Create button.
    select xcode workspace name in project add to drop down list
  5. Now you can see the newly created Xcode project has been added into the workspace. When you exit Xcode tool and launch it again, and when you open the Xcode workspace file again, you can see the project is listed in left navigator pane.
    xcode project has been added into xcode workspace

3. How To Add Exist Project Into Xcode Workspace.

  1. Launch Xcode and open the workspace file in it.
  2. Click File —> Add Files to “Workspace name” menu item at Xcode top menu bar.
    xcode file add files to workspace menu item
  3. Select the Xcode project file ( with file extension .xcodeproj ) in the project saved folder. Then click Add button.
    select the xcode project file to add the project to the workspace
  4. Now you can see the exist Xcode project has been added in the workspace in left navigator pane. You can add multiple exist project follow this steps.
    add multiple xcode projects in one workspace
  5. To make it simple, you can also drag the Xcode project file ( file extension .xcodeproj ) from the project saved folder and drop it to the Xcode workspace navigator pane.
0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x