Xcode 9. Failed to set user-defined property in interface builder

My problem is that the key path and value settings in the interface builder do not seem to work in Xcode 9. There is work in which you make the variable checked.

I created a sample project and details below.

I created a simple test class where I set the properties set for the path and value, for example.

enter image description here

You will see that two lines are set, ignore backgroundColor, which was a test for operability, key path "string" works, but key path "string2" does not. "string" AND "string2" differ from each other so that in their declaration, as shown here.

@IBInspectable var string: String = ""
var string2: String = ""

The result of this code is shown here.

enter image description here

XCode 8, ios9 , - ? , .

+4
1
// mark the line as @objc
@objc var string: String

.

0

Source: https://habr.com/ru/post/1685906/


All Articles