6

I am a android developer and I needed to create and IOS app. So I did and app is ready now. But now I want to make it a Library/Framework. I mean a same code base will be used in different projects per client and they will be able to change the text strings and colors of app. The rest of the business logic will be remain same.

So Simply I have two major question:

  • How to convert the Project into Framework? Do I need to create a separate framework elsewhere and then import the project into it as Coca touch Framework? Am I right??
  • How to make it customizable? What I meant from Customizable is simple two things.
    • 1) Colors of Views. I have two many views. I want A separate file of colors so that I can change color in it and it reflects changes in whole application
    • 2) String. I want to change the text string so that it can be changed in all over the projects.

Please tell me how can I achieve these things. Specially point number two is my main concern.

Note: The project that I want to convert in framework has two many viewControllers and all are built in one storyboard.

3
  • You can use Targets. You would need to create a target per client app. Each target should have its own localisation files for the text and you will want to add a configuration file per target to handle the colours. You will need to create outlets from your storyboard or xibs so that you can then change the colours in code using the configuration file and also so you can set ID's for the strings so the localisation files can kick in. Commented Jul 11, 2018 at 12:26
  • You should take note of item 4.2.6 in the App Store review guidelines… Apps created from a commercialized template or app generation service will be rejected unless they are submitted directly by the provider of the app’s content. These services should not submit apps on behalf of their clients and should offer tools that let their clients create customized, innovative apps that provide unique customer experiences… Commented Jul 11, 2018 at 12:35
  • @Hodson can you give me link for this, also tell me what do you mean by configuration file Commented Jul 11, 2018 at 12:55

2 Answers 2

3

With regard to how to create a framework, here's how I'd do it:

  1. Create a workspace: enter image description here

  2. Bring the project you want to turn into a library into that workspace by dragging it in from the Finder (make sure it's not open in XCode when you do this). Let's call that project FrameworkProj:

  3. Create a target for FrameworkProj of type Cocoa Touch Framework: CocoaTouchFramework

  4. Create a second project, which we'll call SampleProjWhichUsesFramework, and import the framework into it.

As for your question of IB elements being settable via the framework, simply make sure you have IBOutlets for those elements that are marked public, and they will be available to SampleProjWhichUsesFramework as properties of your framework.

Sign up to request clarification or add additional context in comments.

7 Comments

I was reading about it > framework. But in your answer I have couple of confusions. In step 1, how to create a workspace ? sorry I am new to whole ios world
That is great. Just one last question: I read more about target. I can achieve that thing using target too. M I Right ?? also which is more suitable in my case, Where I have same codebase and just a little modifications needed in color scheme and strings as well per client ?? what would you suggest ?
Not for what you want to do. The target is built from the same code, so you'll need distinct code to set the colors in each of your different targets. Better to do that with a framework and separate project files. Hope that helps. Feel free to mark my answer as having answered your question ;).
yes I am feeling free. :) +1 can you please post here the good tutorial on How to make\ framework,
its not working, I have a project and Want to make it library, lets call it libraryProject, now I have created a separate project, and then I gone to File> workSpace : I created the workspace. I draged my LibraryProject in it, but nothing happened. What should be done here ??????
|
2

I think you do not have good idea of the workspace in IOS Xcode. Since in Android the workspace is dealt in another way. But there is a slight difference.

Lets me just tell you about Android and how do you made the Library and add several projects in Android studio. let say you have a Project in Android App, say App1, now you can go to menu and you can add another module as Library. That is fine and easy for you. Now you can create another project like this, GO to new menu, here you can select New Module and then from templates you can select Phone and Table Module. let's call it App2.

Similarly you can add as many projects/app in the same project (in IOS you can think of a Workspace), and in the end, All you need to do is adding Your library project as a module dependency in All App1, App2 projects you created.

So in IOS, workspace you create at first. And then You create App1, App2 in it. You add Library (Private Framework in IOS) in same project level (same directory) Then You can add the dependency of Library into Other App1, App2 and so on other projects you created.

In this way, your codebase will remain the same for others.

You can find the whole tutorial here. It is the best I have found just give it a try.

1 Comment

that is great explanation but can you please show me or any helping link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.