Int
extension Int- 
                  
                  Determine if self is even (equivalent to self % 2 == 0)DeclarationSwift public var isEven: Bool { get }
- 
                  
                  Determine if self is odd (equivalent to self % 2 != 0)DeclarationSwift public var isOdd: Bool { get }
- 
                  
                  Determine if self is positive (equivalent to self > 0)DeclarationSwift public var isPositive: Bool { get }
- 
                  
                  Determine if self is negative (equivalent to self < 0)DeclarationSwift public var isNegative: Bool { get }
- 
                  
                  Convert self to a Double. Most useful when operating on Int optionals. For example: let number: Int? = 5 // instead of var double: Double? if let number = number { double = Double(number) } // use let double = number?.doubleDeclarationSwift public var double: Double { get }
- 
                  
                  Convert self to a Float. Most useful when operating on Int optionals. For example: let number: Int? = 5 // instead of var float: Float? if let number = number { float = Float(number) } // use let float = number?.floatDeclarationSwift public var float: Float { get }
- 
                  
                  Convert self to a CGFloat. Most useful when operating on Int optionals. For example: let number: Int? = 5 // instead of var cgFloat: CGFloat? if let number = number { cgFloat = CGFloat(number) } // use let cgFloat = number?.cgFloatDeclarationSwift public var cgFloat: CGFloat { get }
- 
                  
                  Convert self to a String. Most useful when operating on Int optionals. For example: let number: Int? = 5 // instead of var string: String? if let number = number { string = String(number) } // use let string = number?.stringDeclarationSwift public var string: String { get }
- 
                  
                  Convert self to an abbreviated String. Examples: Value : 598 -> 598 Value : -999 -> -999 Value : 1000 -> 1K Value : -1284 -> -1.3K Value : 9940 -> 9.9K Value : 9980 -> 10K Value : 39900 -> 39.9K Value : 99880 -> 99.9K Value : 399880 -> 0.4M Value : 999898 -> 1M Value : 999999 -> 1M Value : 1456384 -> 1.5M Value : 12383474 -> 12.4MDeclarationSwift public var abbreviatedString: String { get }
- 
                  
                  Repeat a block selftimes.DeclarationSwift public func `repeat`(_ block: (Int) throws -> Void) rethrowsParametersblockThe block to execute (includes the current execution index) 
- 
                  
                  Generate a random Int bounded by a closed interval range. DeclarationSwift public static func random(_ range: ClosedRange<Int>) -> Int
- 
                  
                  Generate a random Int bounded by a range from min to max. DeclarationSwift public static func random(min: Int, max: Int) -> Int
 View on GitHub
View on GitHub Install in Dash
Install in Dash Int Extension Reference
        Int Extension Reference