How to have one core in several applications - ios

My objective is developing several apps using the same core (code) just have different UI (color, asset's, etc.).
I don't know if I can compare to MVC but I want to reuse the Model and Controller having several Views
Important:
Can be only one project?
For example creating different target or other configuration project..
If I discover a bug I want resolve just once.
Generating separated build's.
The bundle have only the resources that I want (new target right?)
I saw several apps using this (theoretically) like sports apps (soccer, etc).
Thanks
**Edit**** More detail

I think you would like to use this : http://www.raywenderlich.com/41377/creating-a-static-library-in-ios-tutorial
The Core can be a project, in which you're going to define the common classes. These common classes may be controllers and views. From MVC point of view, in your app these will be the Model.
I suggest you to prefer Cocoa (Touch) Framework classes.

I create many apps from a single workspace. I have created separate schemes/targets for each apps. I have separate resources/xib/plist/prefix/build files for each targets. In some places, particular target should execute a specific set of code. For this, I have added unique macros in the target'e prefix files.

Related

Having one template app and making multiple different apps from it

I am trying to figure out what would be a good way of setting up application architecture and how to setup Xcode project itself, in the case where I have one base application, and I need to make multiple applications of it where the all apps will have those same base functionalities but will differ in a way that:
Assets may be different
Some features can be added ( new screens that uses new endpoints that are not defined in base app)
Localization can be differ (eg. one app can only be translated to english, and other can support multilanguages)
and probably some more, but you get an idea of what kind of an app (kinda template app) I am referring to.
What would be a preferred way to implement something like this? I guess targets and making a framework for a shared code is one way to go? Or there is something else that would be suitable too?
Target is a good start. Thanks to target memberships, you can "share" storyboards, source files and whatever you want between several targets. Then within each specific target, you add your assets and specific functionalities.
Frameworks can be also a good way to share functionalities between apps. But you can start and try simply with targets, and then later factorize code within frameworks.
The way I would do it could be this way :
Create your project with a single target, let's call it "Blank App"
Develop functionalities and prepare generic assets for this app
When you want to add a new App, duplicate the "Blank App" target, remove membership of default assets, add new ones, add also specific source and resource files, and that's it.
After a few targets, you can spot what can be factorized within frameworks. Add a new framework target, migrate your sources in it, make all apps use this framework, and you'll have a nice system.

Different user interfaces for a core functionality

I have a Swift project which contains a lot of screens (got from xibs and storyboard) with many core functionalities.
Now two different projects based on these core functionalities are needed. The requirements are these projects must have different headers, cells, colors, assets, etc.
Which strategy would you follow to get different interfaces based on target/project, from a single core framework?
static config:
maybe pull all project related variable, and put it in a plist file, working like archiving and unarchiving. when framework loaded, get boot info from that file.
or abstract all these info into a static class? works almost the same way.
some way dynamic config:
delegate pattern: every project who want to use your framework, must
implement one object with pre-designed protocol, use the object to bootstrap framework, your framework should get the project layer based question answers like header file, assets, etc.
sorry for my English, hope this helps.
;)

Build variants (different files for different brands) in Xcode / iOS

Android has very good tools for creating different variants of an app (for example, the exact same code but with a different logo). You just create a different flavour and put a different image for each flavour's directory. How do I achieve this in Xcode? The information I have found on the web is very bad. I tried creating a new target for my project but that created a new storyboard, AppDelegate etc. It just created a new app altogether. I want different resource folders for different brands of the app. I'm using Swift.
You're not likely to get the same kind of setup you could have with Android. There are a bunch of features you could use individually or in combination. rmaddy's comments are good. Another option is creating additional schemes and setting the properties of the project for each one. The important thing to keep in mind is that the simplest solution may not look the way you're expecting.

Create Framework / Library / Module of Swift Objects in Xcode

I am a (very) novice iOS/Swift programmer with a basic question about moving reusable software objects to their own ... something.
I am developing three iPhone apps that present information from three distinct data sets. Those data sets contain unique information but are structurally similar. As such, the apps share some Swift classes that are identical, specifically the classes that model the data. As I continually refactor the code, I find that when I tweak a class in one app's project, I have to remember to go to the other two projects and make the same tweaks to the same classes for those apps. It's getting to be a big headache.
What I would like to do is have one class definition in its own ... something that I can share, link, import, or attach to/from each app's project. From my online research, I suspect that the ... something is a library? or maybe it's a framework? or a module? I have found all three terms are used, but I am not sure how they relate to each other.
Given that all of the software I am writing is in Swift, does Xcode support what I am trying to do? Thank you!
It seems you have the issue of needing the same Swift class in multiple projects. You could build a Framework (aka Module) for this class then copy it in to each project. This is probably the formally correct approach but it is a bit of overkill for just a single class.
Instead, you could just make the file in the Navigator panel a reference in each project to the one actual file.
You could also make a Workspace and then put each project into the workspace and just have the file at the top level (but this may introduce some build complexity).

Create two apps from one (using targets?)

I have an objective c project in Xcode wherein i must have two apps with complimentary functionality. For convenience I have written all of my functionality inside one app but now I need to really separate this into two distinct apps. My question is about how to go about creating the second app. Should I just duplicate the Xcode project folder and make my changes there? I've also read a little about targets. Is that a potential solution to this?
Yes, it sounds like adding another target to your existing project is the way to go for what you're trying to achieve. This article might prove useful to you: https://itexico.com/blog/iOS-Mobile-Development-Using-Xcode-Targets-to-Reuse-the-Code
Yes, target is the way to do it.
Useful link to understand what it is:
https://developer.apple.com/library/ios/featuredarticles/XcodeConcepts/Concept-Targets.html
It depends how the two apps will differ. If the GUI will be very similar then different targets would do.
But if you want flexibility to change the GUI of each app by big amounts then you could create separate projects but put common model functionality into a library which is linked to by the different projects.
Yes you can achieve it by following approachs
Adding a new Target and reusing the code and resources
Or create a framework in a generic way and pull all the reusable codes and resources in that, through this you only need to drag and drop the .framework file in any of you current or future models.
I suggest go with framework

Resources