Skip to content

Commit d376a4a

Browse files
committed
Update README.md
1 parent 2c067ee commit d376a4a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SwiftTask [![Circle CI](https://circleci.com/gh/ReactKit/SwiftTask/tree/swift%2F1.2.svg?style=svg)](https://circleci.com/gh/ReactKit/SwiftTask/tree/swift%2F1.2)
1+
SwiftTask [![Circle CI](https://circleci.com/gh/ReactKit/SwiftTask/tree/swift%2F2.0.svg?style=svg)](https://circleci.com/gh/ReactKit/SwiftTask/tree/swift%2F2.0)
22
=========
33

44
[Promise](http://www.html5rocks.com/en/tutorials/es6/promises/) + progress + pause + cancel + retry for Swift.
@@ -108,20 +108,17 @@ task.progress { (oldProgress: Progress?, newProgress: Progress) in
108108

109109
### Retry-able
110110

111-
From ver 2.1.0, `Task` is **retryable** for multiple times by using `try()` method ([Pull Request #9](https://github.com/ReactKit/SwiftTask/pull/9)).
112-
For example, `task.try(n)` will retry at most `n-1` times if `task` keeps rejected, and `task.try(1)` is obviously same as `task` itself having no retries.
111+
`Task` can retry for multiple times by using `retry()` method.
112+
For example, `task.retry(n)` will retry at most `n` times (total tries = `n+1`) if `task` keeps rejected, and `task.retry(0)` is obviously same as `task` itself having no retries.
113113

114114
This feature is extremely useful for unstable tasks e.g. network connection.
115115
By implementing *retryable* from `SwiftTask`'s side, similar code is no longer needed for `player` (inner logic) class.
116116

117117
```swift
118-
task.try(3).progress { ... }.success { ...
118+
task.retry(2).progress { ... }.success { ...
119119
// this closure will be called even when task is rejected for 1st & 2nd try
120120
// but finally fulfilled in 3rd try.
121121
}
122-
123-
// shorthand
124-
(task ~ 3).then { ... }
125122
```
126123

127124
For more examples, please see XCTest cases.

0 commit comments

Comments
 (0)