Latest 0.7.1
Homepage https://github.com/siejkowski/LetsTry
License MIT
Platforms ios 8.0, osx 10.10, watchos 2.0, requires ARC

Let’sTry

Build Status codecov platforms Carthage compatible

A trio of Try, TryLazy and TryTyped types for wrapping Swift error handling system into composable and elegant API. Also, they’re let-bindable just like the Optional. See for yourself:

Instead of writing:

do {
    let result = try throwingFunction()
    // work with result
} catch {
    print("i guess winter is coming")
}

you can write:

let tried = Try(try throwingFunction())
if let result = tried {
    // work with result
} else {
    print("i guess winter is coming")
}

License

MIT. See LICENSE.md for details.

Latest podspec

{
    "name": "LetsTry",
    "version": "0.7.1",
    "summary": "Try type for wrapping Swift error handling with let-binding (same as Optional).",
    "description": "The current way of error handling in Swift has two problems:n1. The dance of `do`, `try` and `catch` blocks is performed with lots of boilerplate that hurts readability.n2. The composition of multiple code units that `throws` is non-straightforward.nnLet'sTry solves both problems by providing a trio of types for error handling simplification: Try, TryLazy and TryTyped. They are designed with composition in mind (inspired by monadic types) and encapsulate the `do`-`try`-`catch` boilerplate. They can also be used in let-binding statements just like Optional type, which makes using them a pleasure:nn```nlet tried = Try { try throwingMethod() }nnif let succeeded = tried { ... }nnguard let succeeded = tried else { print("failed"); return }n```",
    "homepage": "https://github.com/siejkowski/LetsTry",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": "Krzysztof Siejkowski",
    "social_media_url": "http://twitter.com/_siejkowski",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "watchos": "2.0"
    },
    "source": {
        "git": "https://github.com/siejkowski/LetsTry.git",
        "tag": "0.7.1"
    },
    "source_files": "Sources/**/*.swift",
    "requires_arc": true
}

Pin It on Pinterest

Share This