SJSwiftExtensions is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SJSwiftExtensions'let boolValue = true
boolValue.toggle = falselet trueValue = true
let falseValue = false
trueValue.stringValue /// "true"
falseValue.stringValue /// "false"var array: [Int] = []
array.isNotEmpty /// false
array.append(2)
array.isNotEmpty /// truelet emptyString = ""
emptyString.isNotEmpty // false
let someString = "fooBar"
someString.isNotEmpty // truelet turquoise = UIColor(colorWithHexValue: 0x2FD3C7)
turquoise.darker(by: 10.0) // darkens color by 10 percents
turquoise.lighter(by: 10.0) // lightens color by 10 percentsController identifier, can be used to load ViewController from storyboard by ID
let viewController = SomeBasicViewController
viewController.identifier // "SomeBasicViewController"Register cell for identifier same as cell class name:
tableView.register(CustomTableViewCell.self)Cell dequeue without stating explicit identifier:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tv.dequeueReusableCell(forIndexPath: indexPath) as CustomTableViewCell
return cell
}let cell = CustomTableViewCell
cell.identifier // "CustomTableViewCell"SJSwiftExtensions is available under the MIT license. See the LICENSE file for more info.