Latest0.1.2
Homepagehttps://github.com/dimacheverda/SJSwiftExtensions
LicenseMIT
Platformsios 9.0
FrameworksUIKit, Foundation
Authors

Swift 4.0
CI Status
Version
License
Platform

Installation

SJSwiftExtensions is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'SJSwiftExtensions'

Usage

Bool

let boolValue = true
boolValue.toggle = false
let trueValue = true
let falseValue = false
trueValue.stringValue   /// "true"
falseValue.stringValue   /// "false"

Collections

var array: [Int] = []
array.isNotEmpty   /// false
array.append(2)
array.isNotEmpty   /// true

String

let emptyString = ""
emptyString.isNotEmpty   // false
let someString = "fooBar"
someString.isNotEmpty   // true

UIColor

let turquoise = UIColor(colorWithHexValue: 0x2FD3C7)
turquoise.darker(by: 10.0)   // darkens color by 10 percents
turquoise.lighter(by: 10.0)   // lightens color by 10 percents

UIViewController

Controller identifier, can be used to load ViewController from storyboard by ID

let viewController = SomeBasicViewController
viewController.identifier   // "SomeBasicViewController"

UITableView

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
}

UITableViewCell

let cell = CustomTableViewCell
cell.identifier   // "CustomTableViewCell"

Author

[email protected]

License

SJSwiftExtensions is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SJSwiftExtensions",
    "version": "0.1.2",
    "summary": "Common extension for Foundation and UIKit classes",
    "description": "Common extension for basic classes and types to speed up development time.",
    "homepage": "https://github.com/dimacheverda/SJSwiftExtensions",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "dimacheverda": "[email protected]"
    },
    "source": {
        "git": "https://github.com/dimacheverda/SJSwiftExtensions.git",
        "tag": "0.1.2"
    },
    "social_media_url": "https://twitter.com/cheverda",
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.0",
    "source_files": "SJSwiftExtensions/Classes/**/*",
    "frameworks": [
        "UIKit",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This