This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIViewController { | |
/// Print through console the current view controllers hierarchy. | |
func printHierarchy() { | |
let log = { (str: String) in | |
print("*** *** *** *** *** *** *** *** ***") | |
print(str) | |
print("*** *** *** *** *** *** *** *** ***") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIColor { | |
/// An object that stores color data and sometimes opacity. | |
/// | |
/// This failable convenience init allows to create an `UIColor` from a hexadecimal `String`. Supported format examples: | |
/// - #FFF = UIExtendedSRGBColorSpace 1 1 1 1 | |
/// - #FFF0 = UIExtendedSRGBColorSpace 1 1 1 0 | |
/// - #FFFFFF = UIExtendedSRGBColorSpace 1 1 1 1 | |
/// - #FFFFFF0 = UIExtendedSRGBColorSpace 1 1 1 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UILabel { | |
/// The number of lines required by the containing text taking into account the font line height. | |
var lines: Int { | |
guard let text = self.text as? NSString else { return 0 } | |
let size = CGSize(width: self.bounds.width, height: CGFloat.greatestFiniteMagnitude) | |
let labelSize = text.boundingRect( | |
with: size, | |
options: .usesLineFragmentOrigin, |