https://github.com/janygee/jgswifttimer
利用GCD定时器,解决Timer时间不准的情况
https://github.com/janygee/jgswifttimer
ios nstimer objective-c swift timer
Last synced: about 1 month ago
JSON representation
利用GCD定时器,解决Timer时间不准的情况
- Host: GitHub
- URL: https://github.com/janygee/jgswifttimer
- Owner: JanyGee
- License: mit
- Created: 2021-07-19T04:08:55.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-19T08:20:09.000Z (almost 5 years ago)
- Last Synced: 2025-08-01T17:12:16.890Z (11 months ago)
- Topics: ios, nstimer, objective-c, swift, timer
- Language: Swift
- Homepage: https://github.com/JanyGee/JGSwiftTimer
- Size: 122 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JGSwiftTimer
[](http://cocoapods.org/pods/JGSwiftTimer)
[](http://cocoapods.org/pods/JGSwiftTimer)
[](http://cocoapods.org/pods/JGSwiftTimer)
[]()
JGSwiftTimer is a lightweight timer extension for Swift. [OC](https://github.com/JanyGee/JGOCTimer)
## Installation
JGSwiftTimer is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod "JGSwiftTimer"
```
## Usage
```swift
import JGTimer.h
```
## Methods
**executeTask(start: TimeInterval, interval: TimeInterval, repeats: Bool, async: Bool, task: @escaping ()->Void) -> String?**
```Swift
JGTimer.executeTask(start: 3, interval: 1, repeats: true, async: true, task: {self.doTask()})
```
**executeTask(start: TimeInterval, interval: TimeInterval, repeats: Bool, async: Bool, target: AnyObject, selector: Selector) -> String?**
```Swift
JGTimer.executeTask(start: 1, interval: 1, repeats: true, async: true, target: self, selector: #selector(doTask))
```