Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ashfurrow/haste
NSTimer Extension for Swift
https://github.com/ashfurrow/haste
Last synced: 2 months ago
JSON representation
NSTimer Extension for Swift
- Host: GitHub
- URL: https://github.com/ashfurrow/haste
- Owner: ashfurrow
- License: mit
- Created: 2015-01-30T18:35:00.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-30T18:57:07.000Z (almost 10 years ago)
- Last Synced: 2024-10-09T00:06:18.723Z (3 months ago)
- Language: Swift
- Size: 148 KB
- Stars: 18
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Haste
================Everyone has made block NSTimer categories for `NSTimer` in Objective-C. But who has done it in Swift? Well, probably lots of people, but the point is that it is not as straightforward as you might think.
Usage
----------------1. Add `pod 'Haste'` to your Podfile.
2. Add `import Haste` whevever you want to time things with closures.
3. Call the following function.```swift
NSTimer.scheduledTimerWithTimeInterval(1, block: { () -> () in
println("Why does anyone do the things they do?")
}, repeats: true)```
4. That function returns the `NSTimer` instance, so you can call `invalidate()` on it when you want things to stop.