Skip to content

Commit 6ac744f

Browse files
authored
Update README.md
1 parent 51dbb75 commit 6ac744f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![CI Status](https://api.travis-ci.org/radex/SwiftyTimer.svg?branch=master)](https://travis-ci.org/radex/SwiftyTimer)
55
[![CocoaPods](http://img.shields.io/cocoapods/v/SwiftyTimer.svg)](https://cocoapods.org/pods/SwiftyTimer)
66
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](#carthage)
7-
![Swift version](https://img.shields.io/badge/swift-2.2%20|%202.3-orange.svg)
7+
![Swift version](https://img.shields.io/badge/swift-3.0-orange.svg)
88

99
#### Modern Swifty API for `NSTimer`
1010
###### SwiftyTimer allows you to instantly schedule delays and repeating timers using convenient closure syntax. It's time to get rid of Objective-C cruft.
@@ -13,14 +13,14 @@ Read [Swifty APIs: NSTimer](http://radex.io/swift/nstimer/) for more information
1313

1414
## Usage
1515

16-
You can easily schedule repeating and non-repeating timers (repeats and delays) using `NSTimer.every` and `NSTimer.after`:
16+
You can easily schedule repeating and non-repeating timers (repeats and delays) using `Timer.every` and `Timer.after`:
1717

1818
```swift
19-
NSTimer.every(0.7.seconds) {
19+
Timer.every(0.7.seconds) {
2020
statusItem.blink()
2121
}
2222

23-
NSTimer.after(1.minute) {
23+
Timer.after(1.minute) {
2424
println("Are you still here?")
2525
}
2626
```
@@ -40,15 +40,15 @@ You can specify time intervals with these intuitive helpers:
4040
You can pass method references instead of closures:
4141

4242
```swift
43-
NSTimer.every(30.seconds, align)
43+
Timer.every(30.seconds, align)
4444
```
4545

4646
### Manual scheduling
4747

4848
If you want to make a timer object without scheduling, use `new(after:)` and `new(every:)`:
4949

5050
```swift
51-
let timer = NSTimer.new(every: 1.second) {
51+
let timer = Timer.new(every: 1.second) {
5252
println(self.status)
5353
}
5454
```
@@ -59,15 +59,15 @@ Call `start()` to schedule timers created using `new`. You can optionally pass t
5959

6060
```swift
6161
timer.start()
62-
timer.start(modes: NSDefaultRunLoopMode, NSEventTrackingRunLoopMode)
62+
timer.start(modes: .defaultRunLoopMode, RunLoopMode(NSEventTrackingRunLoopMode)) // Ugly, yes: rdar://27509030
6363
```
6464

6565
### Invalidation
6666

67-
If you want to invalidate a repeating timer on some condition, you can take an `NSTimer` argument in the closure you pass in:
67+
If you want to invalidate a repeating timer on some condition, you can take a `Timer` argument in the closure you pass in:
6868

6969
```swift
70-
NSTimer.every(5.seconds) { (timer: NSTimer) in
70+
Timer.every(5.seconds) { (timer: Timer) in
7171
// do something
7272

7373
if finished {

0 commit comments

Comments
 (0)