Is my xcode project duplicating itself? - ios

I have an Xcode project. I see that there is a folder within the project folder in my Finder with exactly the same name as the project folder and this folder contains a copy of the project and includes, you guessed it, a copy of the project within again and again. The project folder is now 5Gb while the app itself is no more than 25Mb. So I think that the project somehow is making copies of itself. I see that in my Project I have two targets, one of the project name and one with the project name + "- copy" at the end of the target name.
I wonder what I should do to stop my project increasing in size and how to safely remove the copied project folder within.

there was a copy of the project in the target, the solution is to remove the offending folder form within the project in finder and then to remove the copied project in the target.

Related

How to hide path inside Swift Package from Project Navigator managed by XCode?

I've created Swift package, which contains a folder with an example project. Its path is not included in any target sources. Nonetheless, after opening Package.swift file in XCode, Project Navigator still shows not included paths. How to hide that obsolete folder?
As I suppose, it is unlikely that XCode manages Navigator contents using an exclusion path from target configuration. It shows not only files specified in targets but all files included in root path. It is reasonable because the package can contain a readme file that can be edited by XCode, however it is not reasonable for files of the example project.
You can make your folder hidden in your Swift Package by adding . at the begin of its name and the Project Navigator doesn't show it because by default, folders with periods at the beginning of their names are hidden in OS X and XCode as well e.g.: .RxStormExample.

How to properly export Xcode project?

I edited an existing project in Xcode and added a folder in it. In that folder, I placed 2 folders. And created a cocoa touch class in both of them. Now, when I look in to the directory of my project. My classes are not inside the folder, where they're expected.
It should be located in
Screens -> MyView -> View1 & View 2
But instead it is in the Screens folder
On Xcode, it is properly located but when I open the root folder of the project it isn't. How to fix this issue?
Xcode itself does not create any folders for you on your mac.
You have to create the folder structure manually on your mac. Then move the files to the new location.
Next delete them out of Xcode then drag and drop the files from your mac folder to the virtual folders within Xcode.
You will have to create folders manually in your project. Adding files to XCode group does not reflect to your project folder structure. Just remove reference of the existing files from your XCode and then move the required files into your desired folder and add them back to your XCode Project. Hope this will help you.

How to setup a separate iTunesArtwork file for each Target

I have a xcode project with many targets and each target has its own App Icon and Launcher Icon
It's fair to expect that each target has its own iTunesArtwork file.
But the problem here is
The name of the file can't be changed and it should be with the name iTunesArtwork
so I can't add a yet another file in the same project for a different target
The iTunesArtwork has to be in the root of the project or else it'd be ignored
I tried creating different folders for different targets and in the respective folder I dragged and dropped the respective iTunesArtwork but iTunes Completely ignored it.
so is there any way while building the app we can move a file from the respective folder to project root ?
or
is there any other way I achieve this through ?
Note:
I am using jenkins
I solved the problem using Folder references in xcode
Here are the steps
I opened my project in the finder then I created a physical folder
for each target and there I kept the iTunesArtwork and
iTunesArtwork#2x for respective targets
(This folders won't be visible in xcode since we're doing it in the finder and as we have physical directory no name collision problem)
In xcode I opened my project and I created a Group for each Target
I dragged and dropped the iTunesArtwork & iTunesArtwork2x in the
respective Group and I chose the respective target in Target list
and I chose Folder references
Create new image.xcess asset and select target- build settings find xassets replace that neme for your inageassets name for that target

What file to update in an XCode project when some folders names are updated?

I have changed the name of two folders of an XCode project and when I open this project, it doesn't work anymore (XCode can't find the files where the name of the folders were changed). I know it's a little issue and I have tried to find where to update the references to these particular folders in XCode but couldn't find how to.
I have changed where it is written "NewName"
Can you help me to solve that ?
Thanks
Blue Folders in Xcode are physical folders on disk in the project folder.
Navigate to the project folder in Finder by right-clicking on a valid item in the side bar > Show in Finder, quit Xcode, rename the folders in Finder accordingly and reopen the project.
Then check the Build Settings of the target if there are any path references using the old folder names and change them, too.

Using subproject's xcdatamodelId in main project

I have in XCode a main project that relies on a subproject to work. The subproject is basically a library that also define a database model, and the way to interact with it.
To use the subproject in the main project, I just dropped the subproject xcodeproj file in the main project, did some setup (like specifying header search path), and that's it.
I'm using core data, but if I try to use the .xcdatamodelId files directly, by creating managed object context, it fails : looks like the main project can't find the subproject ressources (except .h and .m files).
The only solution I found so far is to copy the .xcdatamodelId file from the subproject in the main project, and it does the trick. But it's not satisfactory, as I have to maintain two files if my model evolves.
I was struggling with this issue for a while and I want to answer it here as I believe it is important.
In order to add model files from a sub-project into the parent project you simply locate the model files you want to add in Finder. You can then drag them into your project into any folder you see fit. When Xcode displays the "Choose options for adding these files" prompt, deselect the "Copy items into destination group's folder" item and you can select either "Create Groups..." or "Create folder references...". After this process you should see the model files under the compile sources phase in Build Settings.
It is important to note that dragging the model files (in Xcode) from the sub-project into either "Compile Sources" or the parent project will not work to my knowledge so rather do it in Finder.

Resources