George_v
George_v

Reputation: 83

Using a Storyboard for many apps

I have two apps where have some same settings. Meaning that in every app there is a share button and a rate button, with the same functionality.

What I do is to copy paste the code in order to create the same functionality (for the rate and share buttons). In fact they have similar design and both are in the same View controller.

So, I want to develop a project where those two buttons (with same design and functionality) will be placed and when I develop a new app to call it, instead of copying and pasting the code.

In a search that I did I find that Storyboard Reference can be a solution(without being sure). Also I have seen about iOS Frameworks.

Please I would like to have your opinions.

Thanks

Upvotes: 0

Views: 112

Answers (3)

Shamsudheen TK
Shamsudheen TK

Reputation: 31311

If you have 2 or more apps where share some settings, then Creating A New Target will work for you.

Go to Project > Targets > Select the original target “MyApp Target” > Right click > Duplicate.

When duplicating a target, the default generates “ MyApp Target copy” .app, .plist, etc. We want to change that.

Rename the new target (select and press enter to edit) to “ MySecondApp Target”.

Under Build Settings, search for “ MyApp Target copy”. You need to rename Product Name to “ MySecondApp”, and rename Info.plist to “MySecondApp Target-info.plist”.

For more details: Create-multiple-targets

Upvotes: 3

Vladyslav Zavalykhatko
Vladyslav Zavalykhatko

Reputation: 17424

Another possible solution, if you're using git, is to make it git submodule and then pull it to all your projects; comparing to option with static library it won't force you to recompile your code after every change

Upvotes: 1

Tj3n
Tj3n

Reputation: 9943

Just pack the code that you want to reuse as a static library(plus resource bundle) or framework or cocoapods project, then you can reuse it for multiple projects without have to copy paste source code

Upvotes: 3

Related Questions