I learnt about Xcode workspace .I know how to share the static library but i want to share the files between two xcode projects in workspace and is it possible to run multiple targets at a time?Can you provide me the information of how to do this.
Thanks in advance
You can just drag-and-drop any xcode-project file (*. xcodeproj) into the project navigation pane of your desired parent-project. You then may need to add target dependencies, depending on your needs.
In the Project navigator, Control-click in the empty space and choose Add Files to “workspaceName”. In the sheet that appears, select an Xcode project (a file with a . xcodeproj filename extension). Click Add to add the project to the workspace.
To do that, right-click on the Remotes folder that is below the project folder on the left pane. Select your GitHub account (or add your GitHub account if you haven't done that already) and complete other details about your new remote. Now you are ready to start sharing your code with teammates.
Sharing files between projects in the same workspace is easy, even if the projects are on the same level (no subprojects):
Assume you want to share constants between Project1
and Project2
, and these constants are defined in a file SharedConstants.swift
, which is defined in Project1
.
In order to be used in Project2
, it must be compiled there.
Thus, activate in the project navigator Project2
, select the target and open the Build Phases
tab.
Open there Compile Sources
by tapping the little triangle left.
Tap the +
button below the listed sources for this target. This will show you a list of files of Project2
. There you cannot select your shared constants, because they do not belong to this project.
However left bottom is a button Add other…
Tapping it will open a standard file selection window where you can select SharedConstants.swift
from Project1
.
After tapping Open
, a 2nd window opens with a Destination: Copy items if needed
checkbox.
Important: Do not check this box!
If you would check it, a copy of SharedConstants.swift
would be used in Project2
, and any changes that you make in Project1
would not be visible in Project2
. Instead, it you uncheck it, only a reference to SharedConstants.swift
in Project1
would be used in Project2
, and any changes will affect both projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With