I want to keep a view always at the front. In Swift CGFLOAT_MAX
and FLT_MAX
are replaced with corresponding .greatestFiniteMagnitude
. So, I used:
view.layer.zPosition = .greatestFiniteMagnitude
It works fine, but now I get a warning:
CoreAnimation: zPosition should be within (-FLT_MAX, FLT_MAX) range.
Is there a way to get rid of the warning (maybe a better value to use here)?
Thanks.
On a 64-bit platform
CGFloat.greatestFiniteMagnitude = Double.greatestFiniteMagnitude = 1.79769313486232e+308
Float.greatestFiniteMagnitude = 3.40282e+38
Apparently the zPosition
should be in the (smaller) range of a Float
:
view.layer.zPosition = CGFloat(Float.greatestFiniteMagnitude)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With