using iOS static library common view controller in storyboard?
Asked Answered
D

1

10

We are in the process of creating a set of common components and common views that are reusable across several applications we have. In these libraries we have the .xib files and view controllers. We want to be able to use these in storyboards for the specific applications. Is this even possible?

I haven't seen an easy way to share reusable views or components from static libraries in storyboards yet.

Whats the recommended way to do this to keep from having code duplicated in every project?

Thanks..

Deficit answered 20/6, 2012 at 15:41 Comment(0)
G
6

Typically when making a static library for sharing, you can also include a bundle with resources (xib and image files for instance). Take a look at the FacebookSDK for instance. It contains a bundle with images and strings. Those can be loaded by the SDK code or the client app of the SDK.

For help on making a static lib with resources, see : https://github.com/jverkoey/iOS-Framework (thanks @jnjosh) or https://github.com/kstenerud/iOS-Universal-Framework. I've used the iOS-Universal-Framework on a shipping app recently. Works well.

In order to use xib files with storyboards, you can take one of two approaches:

Also if it's just for internal use, I recommend simply making a shared repository of code + resources, rather than making a static library. The main benefit of the static library is ease of distribution outside of your team.

Greenman answered 5/10, 2012 at 14:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.