Convert existing Xcode project to Framework - ios

I want to convert an entire (huge) Xcode app project to a Framework - so that other apps would be able to use different part of the project. Would be easier than start dissembling the project (at the moment at least).
How can I do that?

Related

Can I refactor my xcode swift app into a lib?

I have an Xcode swift app that uses "import CoreBluetooth" to access a wearable.
Now, my teammate wants to use my functionality, and thus wants a lib (.a) that he can incorporate into his xcode GUI app.
Can I refactor my app into a lib for him to add to his GUI app?
Or, is the only way to create a new xcode lib project?
Short answer is yes, you can use the same project. You need to separate 2 things:
Project is a design-time / code organization entity. One project can contain framework, app, tests, etc - all at the same time
What actually dictates what is going to be built are Targets. Some targets will build an app, some will build the library etc. Each target may contain any subset of files from your project (as long as they compile).
So that's one way to go about it: create a second target for Framework, add relevant files to Build Phases > Compile Sources and voila.
The advantage is simplicity. The disadvantages are many: how do you know you didn't break compatibility with wearable? how do you know which file belongs to app, and which belongs to app and framework (sure, you can see when you click on file, or folder structure can help, but it's not going to stop the mistake from happening)? or what if compatibility your iOS app needs is different with what wearable app needs? how do you maintain versions of such framework? etc etc
So a much better cleaner way is to create a separate repo for your framework, and maintain it as an internal product you are sharing between various components. That way you can maintain clear versioning, compatibility, and address bugs without the fear of breaking either app or wearable. And you can include that framework in both projects using (like suggested above) Swift Package Manager, or CocoaPods, or even manually.

IOS: One 'Cocoa Touch Framework' Library for both Simulator and Real-Device?

I am working with XCODE 6 and SWIFT 1.2 in my iphone application at the moment and loooking a way to share the common codes between projects.
Therefore thought of creating a 'Cocoa Touch Framework' as explains in following tutorials that contains the codes I want to re-use among projects.
1). How to reuse Swift code in other projects?
2). http://locomoviles.com/ios-tutorials/create-ios-cocoa-touch-framework-using-xcode/
3). https://www.youtube.com/watch?v=86cPaa3FrRg
All ok and I can use the shared codes that contains in the Library project successfully.
So my problem is, this is really annoying I have to integrate framwork that contains in 'Debug-iphonesimulator' folder when testing with simulator and again the library that contains in 'Debug-iphoneos' when testing with a real device...
I see Three folders as follows (Built libraries)
Just generated the release library (the content in 'Release-iphoneos' folder) thinking that this may work in both deice and simulator. But again this works only with real-devices, and not with simulator.
Question 1). Can't I generate one library that can build and use in both 'simulator' and on a 'real device'?
Question 2). Is there any other way I can link (reference) to Framework Project directly rather than integrating a build library? So Project reference to external Framwork and use resources in there (No library integration... Referencing to project like eclipse android libraries and projects)

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.

Sharing a Cocoa Framework between apps (iOS)

I have created a dynamic framework for one of my apps as I was using a lot of the same code for the main app and the extensions. This works well and has reduced the amount of duplicate code in the project.
I am now looking at creating a second app and it would save me a huge amount of time if I could use the framework from the first app.
How would I go about doing this?
My initial thought is to break the framework out into it's own project and include that project in the app projects by using a workspace.
Another thought was to have both apps in the same project, but as different targets.
I also use git, so it would be beneficial to have the framework separate from the apps.

Unity-iOS: Separating Unity iOS project into any existing iOS Xcode project

I have developed Unity iOS project. I am using some 3ds max model files in it with some animation. When I create project through Unity, it does creating it automatically and installing it on the iPad. Now, I want to include this unity based functionality into my existing iOS project. How can i separate this unity project and integrate into my existing iOS Xcode project? I see lot of dependancies in Unity created project. I don't know the steps how can we separate this and integrate into any existing iOS Xcode project?
Please advise!
Here's how we did it using Unity 5.2.2f1, Xcode 7.1 and Swift 2.1.
The steps outlined in the link below seem like a lot, but honestly, aside from the Import/Cleanup of some of the unity files, it takes < 5 min once you know the steps.
https://github.com/blitzagency/ios-unity5
Actually thats not THAT hard to do. But honestly i would recommend not to try to integrate the generated project into your own, but start with the generated project and integrate yours. Since usually your part of the project will have a lot less changes in the build settings and dependencies.
Once you done the integration, you can update from a new export by simply copying the Classes and Libraries Folder from the generated project to the integrated one.
I explain how we integrated Unity into our iOS App in more detail here: http://www.markuszancolo.at/2014/05/integrating-unity-into-a-native-ios-app
regards

Resources