RbSwift 0.5.0

RbSwift 0.5.0

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release May 2017
SwiftSwift Version 3.1
SPMSupports SPM

Maintained by Draveness, draveness.



RbSwift 0.5.0

  • By
  • draveness

RbSwift provides a series of Swift struct/class extension including lots of handy functions with elaborate Documents.

Features

  • [x] Transform functions support for Sequence and Array

    [1, 2, 3, nil, nil, 4, 5, 6, 7]
        .flatten()              #=> [1, 2, 3, 4, 5, 6, 7]
        .select { $0 > 2 }      #=> [3, 4, 5, 6, 7]      
        .reject { $0.isEven }   #=> [3, 5, 7]
        .count                  #=> 3
  • [x] Built-in Regex support for String

    "hello".gsub("l", "abc")    #=> "heabcabco"
    "hello".gsub("l", "lll")    #=> "lllllllllllllll"
    
    if "hello world" =~ "hello" {
        print("this will match")
    }
  • [x] Convenient methods build Date instance

    Date.now + 1.day            #=> 2017-01-01 12:00:00 +0000
    2.years + 1.day > 1.year    #=> true
    

Usage

NumberStringArrayDateRegexHash

Number

String

Array

Date

Regex

Hash

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but RbSwift does support its use on supported platforms.

Once you have your Swift package set up, adding RbSwift as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .Package(url: "https://github.com/Draveness/RbSwift.git", majorVersion: 0)
]

Manually

If you prefer not to use either of the aforementioned dependency managers, you can integrate RbSwift into your project manually.

Contact

Follow and contact me with email. If you find an issue, just open a ticket. Pull requests are warmly welcome as well.

License

RbSwift is released under the MIT license. See LICENSE for details.