Xcode - open more than 1 project in Groups & Files? - ios

Is it possible in XCode to open several projects in one window like in Eclipse?

You can use a Workspace to open multiple projects but it is generally meant to be used for projects that are similar or used together. These projects will share a build directory. This is as close as you can get in Xcode to what Eclipse does.
http://developer.apple.com/library/ios/#featuredarticles/XcodeConcepts/Concept-Workspace.html

Related

Xcode 12 how to add an existing project to a workspace

I cannot believe how hard this is. Perhaps because the word 'workspace' is overloaded by Apple and perhaps because the UI keeps changing every version. For a newbie to iOS, Xcode and Apple it's a nightmare.
I have Xcode 12
I have created a project.
I used File/save as
workspace to create a workspace to (eventually) hold multiple
projects.
Gave it a name.
I have another already created project (a
static library) that I would like to add to this workspace.
I cannot for the life of me figure out how to do it. I see things for
previous Xcode versions but those UI options are not present in 12.
In the end I want to have a workspace where I have a demo project that uses the static library project for Bluetooth LE communications. I will be spending 90% of my time developing the BT library so I want to be able to access the source of both projects.
By the way, I am not using Storyboards. Not sure if that makes a difference, but just in case!
Thanks for any help
You can do this by
Close the project to add in Xcode
Drag the existing.xcodeproj file (one you closed) from Finder to Xcode and drop it next to existing sources/projects in the workspace
Xcode settings are often painful for even seasoned developers. And every update seems to break something.
As far as I can tell it just doesn't seem possible.
The only option seems to be to create the workspace in XCode 11 add the projects there then open in XCode 12
If you already have a Workspace (i.e. a .xcworkspace file) ready to go, all you need to do is:
Close your project
Open your Workspace
Go to File > Add Files to "<your_workspace_name>"...
Select your existing project
Xcode will duplicate the references to your files, so you manually have to go to the Project navigator (shortcut: ⌘ + 1), select the duplicated references (they'll be at your Workspace's root) and delete them (select Remove Reference, not Move to Trash)
Enjoy your Workspace!
For good measure, select your scheme (most times it'll become available immediately, but sometimes you'll need to restart Xcode), build, and run your project to verify that everything went well.
Verified in Xcode 13.

Combine iOS and MacOS projects

I have a project for iOS, and another project for MacOS.
Now I want to combine them (I want to be able to see them both at once, to be able to share code, and to choose which one to build at the scheme).
I know I can go to one of the projects and create there a new target, but isn't is possible to copy a target from one project to another?
It would be a lot simpler, and may save some errors that might occur when creating a new target..
Edit: and what's considered to be better?
one project to hold 2 targets (iOS/MacOS) ? or 2 projects with 1 target each?
You can create a Xcode Workspace (.xcworkspace) under File -> New and then simply drag in both your Xcode projects under the same workspace.

iOS - Xcode module build similar to Android

Android Studio provides module build facility, where different module can be built on its own inside same project. Is there anything similar in Xcode?
Little guide with explanation will be appreciated.
You can create a workspace which can hold multiple projects. You can build each separate project separately and include the required different projects in your final build project. You can run different test codes for different projects also with this approach.

How to create a Xcode 6 workspace that includes 2 iOS Projects and an iOS Dynamic Framework project?

I'm trying to create one Xcode workspace that includes 3 projects:
- 2 different iOS apps
- One dynamic framework project
The two iOS apps should use the framework.
Sounds very easy and reasonable thing to do, but I just can't seem to make it to work.
When I add the framework to the iOS app target as linked library, the build process works but when running I get an exception that the framework could not be found.
If I go to the Embed Binaries -> click add -> choose the framework from the framework project, nothing happens (the embed binaries section stays empty.
I tried to do first add the framework as linked library, then add it to the embed binaries. Now compilation doesn't work (can't find the framework).
What am I missing? Every single example in the documentation shows how to add a framework as a new target under the same project. But that's doesn't help. I want the framework to be a separate project that a team can work on separately.
Open Xcode, so you can see Xcode in the menu bar.
Then go File>New>Workspace.
I believe you just drag and drop other projects into the workspace.
I've never really used a workspace, although I have made one before.

How to properly structure iOS Xcode project for multipeer debugging

I think I've just run headfirst into a big rookie mistake.
Here's my problem: I've developed two iOS applications (client and server). Both the client and server projects have another couple of sub-projects embedded which are common to both projects.
The structure looks like this:
Client
+ subproject (logger)
+ subproject (multipeer session manager)
Server
+ subproject (logger)
+ subproject (multipeer session manager)
I'm trying to debug both the client and server projects at the same time - but xcode doesn't like having the same project opened twice (which I need) and so I'm having to juggle closing/opening/compiling etc etc. While I can operate both apps at the same time(simualtor and device), the last project I open can't access the subprojects (because they are already open) and so I can only debug one at a time (although I can see log output from both). What can I do to restructure my environment so I can debug both apps at the same time?
XCode doesn't support open same project in two windows.
Here I have a suggestion, make logger project, multipeer session manager to two static library projects. Server project includes the two projects, and target depend on the .a files builded by the two library project. Then Client project adds a reference to the two .a files.Therefore, when you run Server project, will build new two .a files for Client project, and then run Client project with using .a files directly;
Are you saying that Client and Server are two different project? Then you can open these two projects one by one, and run them on two different iOS device(or one on iOS device another on simulator).
If you want to launch two simulators, that seems impossible.
If you've only got the one mac (sounds like it) only the last one launched will be able to log to xcodes debugger..
So perhaps you could work out another way to log than NSLog..
Perhaps you have an Apple TV, you could put a temporary second screen airplay view controller up there for logging. Otherwise maybe in a splitviewcontroller on iPad or iPad simulator?

Resources