Latest 1.3.0
Homepage https://github.com/washingtonpost/ios-failable
License MIT
Platforms ios 8.0, watchos 2.0
Authors

ios-failable

Either monad to simplify data in completion blocks

Heavily influenced by Fallible by brentdax and Result of Alamofire. Failable data is generic and can return item(s) or if failed an optional ErrorType.

Requirements

  • iOS 8.0+ / Mac OS X 10.9+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 7.3+

Installation

Embedded frameworks require a minimum deployment target of iOS 8 or OS X Mavericks (10.9).

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 0.39.0+ is required.

To integrate Failable into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

pod 'Failable', '~> 0.2.0'

Then, run the following command:

$ pod install

Example Usage

func example(completion: ((data: Failable<String>) -> Void)?) {
    completion?(data: .Success("hello"))
}

example { (data) in
    if let value = data.value {
        print(value)
    }
}

Latest podspec

{
    "name": "Failable",
    "version": "1.3.0",
    "swift_version": "4.0",
    "summary": "Closure data using Either monad.",
    "description": "An iOS version of Either monad returning either data T or NSError",
    "homepage": "https://github.com/washingtonpost/ios-failable",
    "license": "MIT",
    "authors": {
        "The Washington Post": "[email protected]"
    },
    "platforms": {
        "ios": "8.0",
        "watchos": "2.0"
    },
    "source": {
        "git": "https://github.com/washingtonpost/ios-failable.git",
        "tag": "1.3.0"
    },
    "source_files": "Failable/**/*.swift"
}

Pin It on Pinterest

Share This