Skip to content

Commit

Permalink
edit example
Browse files Browse the repository at this point in the history
  • Loading branch information
nghialv committed Jun 4, 2015
1 parent 20060ff commit 1f0c1b0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
11 changes: 8 additions & 3 deletions DemoApp/DemoApp/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

let f = searchRepositories("Hakuba") <^> { $0[0].ownerName } >>- requestUser
f.onSuccess { result in
println(result)
let e = NSError(domain: "noSuchElement", code: 1, userInfo: nil)

let f = searchRepositories("Hakuba").filter(e){ $0.count > 0 } <^> { $0.first!.ownerName } >>- requestUser
f.onComplete { result in
switch result {
case .Success(let user): println(user)
case .Failure(let error): println(error)
}
}
}
}
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ Usage
- `map` `<^>`
- `flatMap` `>>-`
- `filter`

``` swift
let e = NSError(domain: "noSuchElement", code: 1, userInfo: nil)

let f = searchRepositories("Hakuba").filter(e){ $0.count > 0 } <^> { $0.first!.ownerName } >>- requestUser
f.onComplete { result in
switch result {
case .Success(let user): println(user)
case .Failure(let error): println(error)
}
}
```

- `andThen`
- `recover`
- `zip`
Expand Down

0 comments on commit 1f0c1b0

Please sign in to comment.