UIViewAPI

master

sloik/UIViewAPI

Main Nightly

UIViewAPI

UIKit related domain extensions that you just have to write from project to project.

isHidden

Sometimes getting this in a complicated ifs 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! 🤓

intrinsicWidth

If you need to get intrinsic width of UILabel (width of a label based on its content - font and text)

yourLabel.intrinsicWidth

width

If you need to get width of UILabel

yourLabel.width

linesCount

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

That's it

Hope it will help you :)

Cheers! :D

Description

  • Swift Tools 5.2.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sun Mar 17 2024 00:36:35 GMT-0900 (Hawaii-Aleutian Daylight Time)