9

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

Baibhav Singh
  • 187
  • 2
  • 11
  • Add them into one workspace? – T. Pasichnyk Aug 16 '18 at 10:48
  • but in workspace, i am unable to communicate between viewcontrollers of two projects e.g. push viewcontroller from another project. – Baibhav Singh Aug 16 '18 at 10:51
  • Because you have to put the shared files into top level of workspace hierarchy? The best solution may be to create a private framework which will be shared in all of this projects and contain all needed classes etc. – T. Pasichnyk Aug 16 '18 at 10:52
  • All projects are independent running projects. I tried to make all projects like cocoapod and framework but it failed because for this i have to make all classes public.All projects are contains at good amount of files and assets.Thats why i am stuck – Baibhav Singh Aug 16 '18 at 11:03
  • I find more details in your comments than on the question itself. Please add details onto the question. – Manganese Aug 24 '18 at 05:39
  • 1
    @Manganese thanks. i have added more details for the problem – Baibhav Singh Aug 24 '18 at 07:59
  • Are those projects written in ObjC or Swift? – congsun Aug 24 '18 at 20:59
  • All modules are independent "Swift" project on 4 different branch..having their own podfile and workspace.. – Baibhav Singh Oct 30 '18 at 08:47

5 Answers5

5

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

Rocket Garden
  • 1,166
  • 11
  • 26
2

You've said above that

All projects are independent running projects

which suggests that each of your 4 projects is compiling its source files into an Application.

You seem to be building your own new application, so you don't care about whatever each of these four projects is building. You only care about the source files.

  • Ignore the project files.
  • Locate the .swift files which contain the objects you're interested in.
  • Add them to your own project.
  • Build.
sam-w
  • 7,478
  • 1
  • 47
  • 77
  • thanks. But for one time manual is good. But i want to automate this thing. so that for any update in any project , i will update only the library/framework and i got the final project with all updated projects . – Baibhav Singh Aug 16 '18 at 13:09
2

I think what you want to say, is to open a particular View controller on your second application from you first application. You can achieve this by using URL Scheme in iOS.

  1. Go into your app's info.plst file.
  2. Add a Row to this and call it "URL types"
  3. Expand the first item in "URL types" and add a row called "URL identifier", the value of this string should be the reverse domain for your app e.g. "com.yourcompany.myapp".
  4. Again, add a row into the first item in "URL types" and call it "URL Schemes"
  5. Inside "URL Schemes" you can use each item as a different url you wish to use, so if you wanted to use "myapp://" you would create an item called "myapp

your structure should look something like this

Check this link, you will get better understanding, Thanks. iOS Custom URL Scheme

SAURABH SANWAL
  • 139
  • 1
  • 11
0

You can use Multiple URL scheme concept to achieve that feature.Just like in Android multiple flavour concept

S.Govind
  • 61
  • 9
0

If you already have all the source files you need in your workspace as projects, you need to create a new target Framework and at add needed controller and its dependencies to the framework. (via right side panel first tab or directly from the build settings). Add this framework to the dependencies of you app and import it. Be careful you probably should make at least your controller public/open(if you need subclassing)

Alex V.
  • 29
  • 4