Latest 0.8.0
Homepage https://github.com/typelift/Swiftx
License MIT The MIT License (MIT)

Copyright (c) 2015 TypeLift

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Platforms osx 10.9, ios 8.0, tvos 9.1, watchos 2.1, requires ARC
Authors ,

Swiftx is a Swift library containing functional abstractions and extensions to
the Swift Standard Library. Swiftx is a smaller and simpler way to introduce pure functional
datatypes into any codebase.

For a more full-featured library checkout Swiftz.

Setup

Swiftx can be included one of two ways:

Framework

  • Drag Swiftx.xcodeproj or Swiftx-iOS.xcodeproj into your project tree as a subproject
  • Under your project’s Build Phases, expand Target Dependencies
  • Click the + and add Swiftx
  • Expand the Link Binary With Libraries phase
  • Click the + and add Swiftx
  • Click the + at the top left corner to add a Copy Files build phase
  • Set the directory to Frameworks
  • Click the + and add Swiftx

Standalone

  • Copy the swift files under Swiftx/Swiftx into your project.

Introduction

Swiftx provides a number of common data types and abstractions any codebase can utilize.

A small example:

import Swiftx

let str : String? = .Some("Hello ")
let greeting = (+"World") <^> str // .Some("Hello World")

Seamless interaction with existing platform libraries is also possible with
minimal effort:

import Foundation
import struct Swiftx.Result

/// result now contains either an array of file paths or the error generated by `NSFileManager`.
let result : Result<[String]> = from({ ep in
    let documentsDirectory : String = (NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String)
    return (NSFileManager.defaultManager().contentsOfDirectoryAtPath(documentsDirectory, error: ep) as [String]?) ?? []
})

Swiftx can even help with expressions of nothingness or errors:

import Swiftx

/// We may not be able to do what we said we'd do, but this definition compiles. At runtime, 
/// any code that invokes this function will immediately halt the program.
func provePEqualsNP() -> Proof<P, NP> {
    return undefined()
}

System Requirements

Swiftx supports OS X 10.9+ and iOS 8.0+.

License

Swiftx is released under the BSD license.

Latest podspec

{
    "name": "Swiftx",
    "version": "0.8.0",
    "summary": "Functional data types and functions for any project.",
    "homepage": "https://github.com/typelift/Swiftx",
    "license": {
        "type": "MIT",
        "text": "        The MIT License (MIT)nn        Copyright (c) 2015 TypeLiftnn        Permission is hereby granted, free of charge, to any person obtaining a copyn        of this software and associated documentation files (the "Software"), to dealn        in the Software without restriction, including without limitation the rightsn        to use, copy, modify, merge, publish, distribute, sublicense, and/or selln        copies of the Software, and to permit persons to whom the Software isn        furnished to do so, subject to the following conditions:nn        The above copyright notice and this permission notice shall be included in alln        copies or substantial portions of the Software.nn        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORn        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEn        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERn        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THEn        SOFTWARE.nn"
    },
    "authors": {
        "CodaFi": "[email protected]",
        "pthariensflame": "[email protected]"
    },
    "requires_arc": true,
    "platforms": {
        "osx": "10.9",
        "ios": "8.0",
        "tvos": "9.1",
        "watchos": "2.1"
    },
    "source": {
        "git": "https://github.com/typelift/Swiftx.git",
        "tag": "0.8.0",
        "submodules": true
    },
    "source_files": [
        "Sources/Swiftx/*.swift",
        "Carthage/Checkouts/Operadics/Sources/Operadics/Operators.swift"
    ]
}

Pin It on Pinterest

Share This