/swiflet

Provides `=>` like `let` in Kotlin for Swift

Primary LanguageSwiftMIT LicenseMIT

Swiflet

Swiflet provides => which works like let in Kotlin. => is useful when a return value is used multiple times in an expression.

// Similar to `x() * x()` but calls `x()` just once
let square = x() => { $0 * $0 }

It is possible to throw errors in a closure passed to => because => is marked with rethrows.

do {
    try x() => { try throwable($0, $0) }
} catch {
    // Error handling
}

Lisence

MIT