UIKit related domain extensions that you just have to write from project to project.
isHidden
Sometimes getting this in a complicated if
s might be hard. Now you have isHidden
, isNotHidden
, isVisible
and isNotVisible
to help you say what you want 💬
Old:
view.isHidden = false
or
if view.isHidden == false {
// ...
}
That's annoying... now you can do what you have always wanted!
if view.isVisible {
// ...
}
if view.isNotVisible {
// ...
}
if view.isNotHidden {
// ...
}
// with old
if view.isHidden {
// ...
}
And you can also set on those properties to if you want:
view.isVisible = true
view.isNotVisible = true
view.isNotHidden = true
// with old
view.isHidden = true
That way you can always say what you want without inverted logic! 🤓
If you need to get intrinsic width of UILabel (width of a label based on its content - font and text)
yourLabel.intrinsicWidth
If you need to get width of UILabel
yourLabel.width
If you need to get number of lines in UILabel. If your view uses Auto Layout call self.layoutIfNeeded() to receive proper number of lines.
yourLabel.linesCount
Hope it will help you :)
Cheers! :D