I'm developing an App and I wanted to separate in 'subprojects', because, although some parts have the same name, they have distinct functionality... I've tried this feature (subproject), but it seems that I can't reference files (like storyboards) from a subproject... So, what's the point of a subproject if you can make it work together with the project base?
Thanks a lot...
-
1You can try to create new target for your purposes. You can specify different implementation to different parts. For example you can create two files named the same (or not), add one to first target and the second file to other target. Then add in both files the method with identical naming, but different implementation. Call this method from somewhere. Now you have two apps with different flows that have shared source files, storyboards, assets, etc. Note that app can not see files which are not added to target. To build specific target you should select required scheme on top panel.Nikolay Tabunchenko– Nikolay Tabunchenko2017年10月23日 18:56:58 +00:00Commented Oct 23, 2017 at 18:56
-
That's kind what I'm looking for... Can I have one storyboard reference to storyboard from another target? I'm trying that but it's not working... Thanks a lot for your help!Cleversou– Cleversou2017年10月23日 19:00:14 +00:00Commented Oct 23, 2017 at 19:00
-
1Two different targets are two different scopes. So you should manage this reference from your code. Also you can create two different storyboards with same naming and use it in one file added to both targets. The trick is that these storyboards will be in different targets, but the file which would instantiate them was added to both targets, and it really should't care about which of targets is launched.Nikolay Tabunchenko– Nikolay Tabunchenko2017年10月23日 19:07:48 +00:00Commented Oct 23, 2017 at 19:07
-
1>and both can access my BASE models right? - Yes. >I want to make a "link" to Main.storyboard from LOGIN target, and later, from LOGIN to DASHBOARD... Is that possible? - No, it is not. To get access to any file it should be added to targetNikolay Tabunchenko– Nikolay Tabunchenko2017年10月23日 19:17:20 +00:00Commented Oct 23, 2017 at 19:17
-
1No, because it is not in its scope. For example if you will not include header file in objective-c, you will not be able to use its methods. It is out of the scope of another one. If you want tho see one storyboard from another - they should be it same scope, that means - in one target. P.S. Not everything should be handled directly from interface builder, and it's ok :)Nikolay Tabunchenko– Nikolay Tabunchenko2017年10月23日 19:24:58 +00:00Commented Oct 23, 2017 at 19:24
1 Answer 1
Subprojects are generally used for independent, reusable code, mostly libraries and frameworks. They aren't usually used for organizing parts of a single project.
In Swift, subprojects can be useful for creating modules, but again this isn't commonly done except for independent, reusable code (mostly libraries and frameworks....)
If you're trying to access storyboards in another module, you've probably broken the "independent" part. It is rare to organize UI elements this way, and definitely isn't something you should do in your first project. Once you have some experience working in a larger project, you can explore novel ways of organizing it, but to start, just keep a single project.
This makes me a bit nervous:
although some parts have the same name, they have distinct functionality
They probably should have different names then.