Changing iOS app template - ios

I have an app which I developed by picking "Empty application" when I started off. But now I want to change its template from empty to "Master Detail" like the Facebook, Google+ or Hike apps. Is there a straightforward method to do this or do I have to start from scratch?

Once the project has been created the template that was used to create it means nothing. It is just used to seed the project with files. Therefore, you could create a "Master-Detail Application", delete the extra frameworks, controllers, and views, and now have an "Empty Application".
The reverse is also true. You could either add the controllers or views that you now want, or you could create a second project. Once you have the second project, it may be easier to bring your current code into that project or learn from the second project and bring that into your current one.

Related

Converting an existing project into customizable framework

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.
With regard to how to create a framework, here's how I'd do it:
Create a workspace:
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:
Create a target for FrameworkProj of type Cocoa Touch Framework:
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.
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.

How to add a project inside a xcode project as a module

I am already having an APP with some modules.Now i want to add another project to it as a module.
On a button click of first project i want to run the second project.Like i want to load storyboard of second project from the first one.is there any way to do so.
You can do that by loading a the other storyboard on your project.
see this post here, as it might be able to answer your question.
Here you can have the Documentation from Apple Developers Site

How to customize ViewController template file for Xcode?

I want to add some stuff to the built-in UIViewController template for new Projects (for example, keyboard dismissal methods). I found this question that explains how to go into the Xcode bundle, and modify a particular class template. However, when I make a new iOS Project, the particular template that I find in the iPhoneOS folder is slightly different from the one that is actually used, and of course, my modifications to the template don't take effect (after restarting Xcode to make sure). (FYI, I am selecting iOS / Single View template to start the Project.)
Then, of course, how do you protect the customizations you make from updates to Xcode? I assume when the .app bundle is overwritten by a download from the App Store, it will overwrite all the templates?
You need to create a custom Xcode project template and tell that project template to use your customized ViewController file. Creating custom project templates is a royal pain and too large a subject to cover completely in an answer here. What I can answer here is where to place your custom templates so they don't get overwritten by Xcode updates. Place your custom project templates in the following folder:
/Users/Username/Library/Developer/Xcode/Templates/Project Templates/GroupName
Where GroupName is the group name on the left side of the New Project Assistant. You can create your own group name or use one of the existing group names.
A Google search for Xcode custom project templates uncovered the following article for Xcode 7 on the first page of results:
How to Create Custom Project Templates in Xcode 7
I wrote everything I know about creating custom Xcode project templates in the following article:
Creating Custom Xcode 4 Project Templates

How to create or define a new target in a custom Xcode project template

TL;DR: What XML snippets do I add to my TemplateInfo.plist files, to create a second compiler target when creating a new Xcode project?
While working on my own Xcode project template, I'm trying to have KIF integration testing working in a 'out of the box' sort of way. KIF requires you to duplicate your regular target and then modify some properties. This is normally done manually, but it both takes time and leaves a margin for error, while it's so mundane it could be automated.
For clarity, I'm looking to create the second target in this screenshot automatically:
I got quite far with the whole template customization, but I just can't figure out how to create another target, even though the templates create one for unit testing if you hit that checkbox. How does Apple do that?
Have a look at the template project over at my github repository. If you want to see what I'm doing with KIF (even though for the answer of this question this is should not be necessary), have a look at the plist in the KIF Integrations.xctemplate folder.
If I understand your question correctly...
To duplicate the Build Target automatically without manually creating a new one and setting it up select the one you want to duplicate and press CMD+D
(Instructions on how to do the same things but with (the more likely) build schemes (for future users who wonder to this question) are below:
In xCode click Product (top bar... across from File, Edit, View, etc.) and then at the bottom of the drop-down menu click "New Scheme".
To duplicate your scheme (like you suggested) click "Edit Scheme" instead of "New Scheme" then click "Duplicate Scheme"

An iOS app with multiple brandings

I have an iphone app working just fine - it basically just displays news from a feed, but now we want to have a second app that is a clone of the first but branded a different way and displaying news from a different feed - the xml feed and the graphics/colors would be the only difference.
I'm trying to not duplicate any effort. I can easily set a define and build the app using different colors and images and the xml feed url with one codebase. But what is the preferred way to do this so that I can make a change to some common code and easily rebuild both apps and get them updated in the app store without maintaining separate xcode projects, separate files, etc?
You can do this easily by adding a new target to your project.
Create unique branded assets and configuration files with identical names, but keep them in different folders. When you're ready, add each folder to the project and set the "Target Membership" to the appropriate target. If you make a mistake, you can change it in the File Inspector pane.
When you build a specific target from the shared codebase, only those resources will be bundled with the app. As long as the filenames are identical, it should work.
You can use one project with more then one target. For each target you can add different resources (Info.plist, icon, etc.).
XML feed can be defined in settings.bundle (which also can be dependent on the target).
Layout you can read from dictionary, which also should be dependent on the target.

Resources