Latest 0.1.0
Homepage https://github.com/leibniz55/ThenElse
License MIT
Platforms ios 8.0
Authors

Version
License
Platform

Simplest extension of Bool.

Example

  var odd: Set = [1,3,5,7,9]
  var even: Set = [2,4,6,8,0]

  odd.insert(1).inserted.then {
      print("inserted")
    }.else {
      print("do not inserted")
    }
  // print : "do not inserted"

  let insertResult = even.insert(1).inserted.then{
      return "inserted"
    }.else{
      return "do not inserted"
    }

  print("(insertResult)") // print: "inserted"

  let value = 11

  let filterArray = (value % 2 == 1)
    .then{ () -> [Int] in
      let arr = [Int](0...value).filter{ $0 % 2 == 1 }
      return arr
    }.else { () -> [Int] in
      let arr = [Int](0...value).filter{ $0 % 2 == 0 }
      return arr
    }

  print(filterArray) // print: [1, 3, 5, 7, 9, 11]

Installation

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

pod 'ThenElse'

Author

leibniz55, [email protected]

License

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

Latest podspec

{
    "name": "ThenElse",
    "version": "0.1.0",
    "summary": "ThenElse is extension of Bool.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/leibniz55/ThenElse",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "leibniz55": "[email protected]"
    },
    "source": {
        "git": "https://github.com/leibniz55/ThenElse.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ThenElse/Classes/**/*",
    "swift_version": "3.0"
}

Pin It on Pinterest

Share This