Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have 4 different xcode projects.i want to call viewcontroller of different project from one single project.How can i do this

I have 4 different XCode projects for different modules on different branches of git. I want to make a common project/app through which i can call all 4 modules. There modules are to be displayed like list in table. Through a common login all modules will be called. How can i do this?

what i have Done till now: I have taken all modules checkout and added them in a single workspace. But without making them framework, i am unable to call them from the common project. Also my modules are large and framework classes to accessed need to public. So is there not any other good way to do this. Hope i am able to clearify my problem..

thanks

like image 641
Baibhav Singh Avatar asked Aug 16 '18 10:08

Baibhav Singh


People also ask

How do I integrate one project to another File in Xcode?

You can just drag-and-drop any xcode-project file (*. xcodeproj) into the project navigation pane of your desired parent-project. You then may need to add target dependencies, depending on your needs.

How do I open another project in Xcode?

In the Choose a project pane, choose the Browse button to select an Xcode . pbxproj file. Navigate to the project file in the Select Xcode project file dialog, and then choose Open.

How do I link my storyboard to ViewController?

Create a new IBOutlet called shakeButton for your storyboard button in your ViewController. swift file. Select the shake button in Interface Builder. Then hold down the control button ( ⌃ ) and click-drag from the storyboard button into your ViewController.


1 Answers

To solve this you need a dependency management solution, because you want changes to the individual projects to be reflected automatically in the overall project. You have decided you can't use frameworks which are the natural choice for this, for practical reasons (the framework class size and access level).

The solution is to find a different dependency management solution for your source code.

The next most obvious option is to use git submodules, because this has been explicitly designed for modularising at the source level. If you use this in conjunction with the solution suggested by @sjwarner for project organisation you should be able to achieve what you need.

https://git-scm.com/book/en/v2/Git-Tools-Submodules

"Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate."

In other words you can continue to maintain each view controller separately, and the commits can be included into your overall project.

(Note that the submodules do not have to be the individual projects themselves, you could potentially make only the viewcontrollers separate submodules, but this might be a bit more complex to set up and maintain)

a) make each project containing the view controller you want a git repository if it is not already one.

b) create a git repository for your main project (if it is not already one)

c) add each project as a git submodule to your main git repo

d) follow @sjwarners suggestion on source code organisation for the overall project

like image 68
Rocket Garden Avatar answered Nov 16 '22 01:11

Rocket Garden