Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IBInspectable and floating point values

Tags:

xcode

ios

swift

Is it possible to set floating point value in Attributes Inspector? I have this property in my UIView:

@IBInspectable
var scale: CGFloat = 0.90 {
        didSet {
            setNeedsDisplay()
        }
    }

As you can see, default value is 0.9 and I would like to change it in Attributes Inspector, but it looks like that:

Attributes Inspector

And I am only able to set integer values in there. Am I missing something?

like image 862
Sebastian Osiński Avatar asked May 12 '15 10:05

Sebastian Osiński


1 Answers

You can set it. What worked for me was using a comma when entering the number instead of a period. And as commented by @Alladinian:

[T]he decimal separator [might just be] locale (region) dependant.

Here it's 0,5, not 0.5: 0,5

Here it's 0,8, not 0.8: 0,8

like image 147
Marcus Rossel Avatar answered Sep 28 '22 13:09

Marcus Rossel