Is it possible to develop an iOS Framework with Storyboard and its view controller in it? While I initialise the entry method in framework from any iOS app , it's required to go to the storyboard which we bundled with framework.
Asked
Active
Viewed 3,290 times
3 Answers
3
One way of creating UI Framework is to create VCs with nib file. If you have segues defined within the framework, then go for storyboard.
If you are using storyboard, expose UI helper class wherein you can instantiate VCs from storyboard. For eg:
public class Utility {
public static func getHomeVC() -> UIViewController {
let storyboard = UIStoryboard.init(name: "HomeScreen", bundle: Bundle(for: self))
let homeVC = storyboard.instantiateViewController(withIdentifier: "FrameworkHomeVC")
return homeVC
}
}

Rikesh Subedi
- 1,755
- 22
- 21
1
Yes.
The storyboard is there just to hold your UI. You can use it to instantiate ViewControllers
.
The code is separated into code files.

TawaNicolas
- 636
- 1
- 5
- 11
-
Could not find a storyboard named '--' in bundle NSBundle , Always getting this error – Abbut John Nov 06 '17 at 11:04
-
I put the Storyboard in the public section , then just build in the xcode simulater , i can see those in framework but the sample app is taking the stroryboard from the framework – Abbut John Nov 06 '17 at 11:06
-
Your storyboard is probably not being copied to the NSBundle. Go to your project's `Build Phases` and check if the `Storyboard` is added to `Copy Bundle Resources` – TawaNicolas Nov 06 '17 at 11:08
-
1Yes it's working now !! the issue was with Bundle ,While creating storyboard instance by code , i given NSBundle* frameworkBundle = [NSBundle bundleForClass:[any_framework_class class]] instead of self or nil , then it's working fine. – Abbut John Nov 06 '17 at 12:46
0
[iOS Framework] is just a container for sources and resources(like .storyboard
).
When you build framework with .storyboard
you get something like

Here you can find .storyboardc
which is compiled .storyboard

yoAlex5
- 29,217
- 8
- 193
- 205