Skip to content

eonist/ResultSugar

Repository files navigation

Lang mit SwiftLint Sindre Tests

ResultSugar

Sugar for Result

Install:

  • SPM: .url("https://github.com/eonist/ResultSugar.git"), .branch("master")
  • Manual Open .xcodeproj

Example:

typealias OnComplete = (Result<String, Error>) -> Void
ResultSugarTests.assert(flag: true) { result in
   guard let msg: String = result.value() else { Swift.print("\(result.errorStr)"); return }
   Swift.print("\(msg)") // Works 👌
}
static func assert(flag: Bool, complete: OnComplete) {
  if flag {
     complete(.success("Works 👌"))
  } else {
     complete(.failure(NSError("Doesn't work 🚫")))
  }
}

Todo:

  • Make more succinct example
  • Make more examples
  • Make more Unit-tests

About

Sugar for Result

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages