Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift @IBInspectable properties in a framework not displayed to Interface Builder

I'm trying to make a framework of a custom UIViewController using @IBInspectable to edit its properties in Interface Builder.

public class BWWalkthroughPageViewController: UIViewController {
    @IBInspectable public var speed: CGPoint = CGPointZero
    @IBInspectable public var speedVariance: CGPoint = CGPointZero
    @IBInspectable public var animationType: String = ""
    @IBInspectable public var animateAlpha: Bool = false
}

If the framework source code is in a sample app project, the properties come up to Attribute Inspector as shown in the image below,

IBInspectable

but if I add the built framework to my app project, the properties are not displayed in the inspector.

Is it possible to show the inspectable properties in a built framework to Interface Builder? If possible, how to?

Here is the framework source code, which is forked from a non-framework project. https://github.com/yoichitgy/BWWalkthrough/tree/support-carthage

like image 853
Yoichi Tagaya Avatar asked Mar 10 '15 18:03

Yoichi Tagaya


1 Answers

Creating framework

Create default framework and add there your swift files.

enter image description here

Then set your swift files as public.

enter image description here

After that copy your framework and add it to your project folder

enter image description here

Use the framework

Add the framework in your project

enter image description here

Create new viewController in your storyboard and set viewController's class which is located in your framework

enter image description here

Thats all. You will see your your properties in the storyboard.

like image 93
Vasily Bodnarchuk Avatar answered Nov 10 '22 11:11

Vasily Bodnarchuk