Are these files needed inside the .app file? (swift) - ios

I'm very new to xCode (or compiled code in general) and I was wondering when I was looking through the .app file if all these were needed.
For every of my classes there is a .o; .d; .swiftdeps; ~partial.swiftdoc; ~partial.swiftmodule file.
Some of these files also contain my working directories...
In the Build Phases of my app I added all my classes to Copy Bunde Resources (otherwise I would get a compile error), maybe that is the reason or are all these files just necessary?
Because when I was looking through over apps I did not find any of these kind of files.
Thank you for your help. :)

Related

Use an entire app as a dependency?

Without going into the why, I need to use an entire app for various classes and libraries it has and includes.
Is there a way I can use the entire project as a dependency? When I choose "static library target" I lose all the hundreds of classes in the "compile" step. Effectively I would like to be able to package the project such that I can use it elsewhere.
Is there an easy way to do this aside from building my new app out of the old app and changing the app name/launch targets?
You have to find a way to transport every element into the new XCode project. iOS app consists of:
main.m file - You probably won't need to copy that, as it's usually just one line.
Source files and headers for: appDelegate, ViewControllers etc. - I don't understand why you would "lose all the hundreds of classes" during compile time. You're the one that chooses what is to be included in the static library. Add all the header files you need to "Copy headers" in the static library target "Build Phases". Add all the source files into "Compile sources". There are many tutorials and StackOverflow posts on how to do that. (example: How can I create static library and can add just .a file on any project in ios)
Storyboards, xib files, *.plist files, images and other resources - you need to put these in a *.bundle file . Just create a new target (which is a bundle) and include all the needed resources in it. Then you'll have to find a way to use them in the new XCode project. For example setting the default *-info.plist or *.pch file: How to tell Xcode where my info.plist and .pch files are or setting the main storyboard.
So you end up with two files: one framework/static library and one bundle file. It shouldn't be that hard to configure new XCode project to use resources from the bundle and classes from the static library.
I'm not sure if I understood your question.
You can add your old app as a project to your workspace and add it as a "target dependency" to use it.
The easiest and safest way to do this is to copy the whole workspace and change the initial view controller.

How can I arrange my project files according to their folder structure in Xcode

I am working on a MASSIVE project with about 10 thousand files in it. The files are nicely arranged in Xcode's directory system but not so on the disk. Is there a tool that I could use that would make the folder structure on my disk represent the folder structure in Xcode?
Personally, I know two ways to do it:
Do it manually (rearrange your folder first, and then drag and drop your directories in xcode). That will do the job.
Use an external library, I suggest you synx. It does the job well
I don't know why you want to do that, but I don't think it's really important if your folder isn't ordering with your xcodeproj since you will always open it with xcode. Just separate assets is enough, isn't it?

Legacy iOS app didn't use folder structure for it's files at all. How to refactor without individually telling each file where it now lives?

I have inherited an iOS app where all the class files were dumped into the root directory. In the project there are groups but the files themselves are not in folders.
How do I go about refactoring and redoing the project so I can create folders and put the files into them, without having to manually tell each file where it now lives in the xcode sidebar.
I'm going to assume there's some sort of 'auto-scan for files' feature but I'm worried that this could end up causing all sorts of compilation issues.
If there's a safe way to do this appreciate the help!

How to add large number of static files to MonoTouch bundle?

I have (quite a bit of) static files that I need to deploy with my application that is built on top of a legacy .NET library. These include several XML and config files, and a read-only database in the 10's of Megabytes.
Most forums I have seen indicate that the best way to accomplish this is to reference the needed files in a project, and set them to Content and "Copy to Output Directory".
I have two issues/questions dealing with this:
Adding these files, and setting them to "Content" seems to not only copy the files over, but embed them into the .dll as well. In other words, I have 40 MB worth of files, and a 40MB dll (this project's only goal is to import these files, there is no substantial code).
How can I prevent this extremely large dll from being made?
Is there an alternative way to get files into the App bundle? I would love to use a custom build command, and although I can copy files into the target directory ${AppDirectory}, but this does not result in these files ending up in the app bundle. Is this approach possible?
Any help is appreciated in advance.
You need to include your files from the main .exe project. You do this by using MonoDevelop's Build Action to Content on each file. They should be copied to the .app without being included inside an .dll (or the .exe).
An alternative (for development) is to use iTunes sharing to copy once your files to your device. This allows you much faster deployment times while developing.
Of course you can't submit such build to the app store (unless the files are not required to make the application work, unlikely). What I do (for my nearly 80MB read-only database) is to use this hack (loading from /Documents) inside #if DEBUG. The release build load the files from the normal location.
I have not automated the process (still debugging the app ;-) but it should be possible to script this so modifying the project options (for each file) is not required when switching from Debug and Release builds.

What's the best way to swap Xcode contents for projects intended for many clients?

I've got a relatively large Xcode project that produces a single app. However, I have many clients/customers who require deep customization and branding of said app. These configurations include different graphics, a few different interfaces and implementations, and, perhaps most importantly, .xcconfig files.
My Xcode project has a dedicated group that points to a particular client's customization folder on disk, so by opening the Xcode project and building, you get a build of the single app with the current client's customizations. To switch to another client, I change where that group points to on disk. (I also change and switch-back the xcconfig "Based On" settings in the project's Info pane to reload the full xcconfig inheritance; Simply changing the group containing one or more xcconfig files doesn't reload this!) This has worked great for 100+ clients. It's a little tedious to switch this folder every time you need to build the app for a different client and ensure the xcconfig is correct, but it works.
Now I'm in the process of automating builds via the command line, and running into troubles. The quick and dirty solution to pointing the aforementioned Xcode group at a different customization folder was to copy the ProjectName.xcodeproj/project.pbxproj file to ProjectName.xcodeproj/project-template.pbxproj and put placeholders inside this file that can be grepped and replaced with the name and path of the desired customization folder. Then, temporarily overwrite project.pbxproj with the modified project-template.pbxproj, and build to get the correct app.
As you've probably observed, the project.pbxproj was duplicated and modified, and will therefore get out of sync as developers modify the original and forget to also update the template. And besides, I shouldn't really be messing with pbxproj files in this fashion anyway -- that's Xcode's private stuff.
So, is there a better way to tell Xcode about a folder full of resources, code, and config files perhaps during the Build Phase with a script or environment variable, rather than at the project group level? The most complicated bit seems to be the xcconfig chain, since each client has their own xcconfig file that inherits from the single app's Debug, Development, and Distribution xcconfig files.
Sorry for the long-windedness of this question, but it's a little complicated! Any suggestions would be greatly appreciated!
I think you would way better off using the targets feature in Xcode. Have one project and the resources of every clients in that project.
You can then duplicate the target you already have (right-click on your target, by selecting the project file in Xcode's Project Navigator).
All your targets will be compiled with the same code. You just need to change the resources in Build Phases > Copy Bundle Resources to have different app created for each target. No need to look at Xcode's internal files.
You can even change the code in your source files by adding a preprocessor macro in your build options (something like FIRST_CLIENT=1) and then look for these definition in your file with #if FIRST_CLIENT.
I have a project set-up like this and it works pretty well :

Resources