Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Well-tested GCD Timer in Swift

License

NotificationsYou must be signed in to change notification settings

hemantasapkota/GCDTimer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Carthage compatible

GCDTimer

Well tested Grand Central Dispatch (GCD) Timer in Swift. Checkout thetest file.

Usage

Long running timer

import GCDTimerclassDemo{init(){lettimer=GCDTimer(intervalInSecs:20)        timer.Event={println("Hello World")            // Send some data to the server}        timer.start()        //Don't forget to pause the timer in the AppDelegate:applicationWillResignActive(application: UIApplication) method.}}

Autofinishing timer

import GCDTimerclassDemo{init(){lettimer=GCDTimer(intervalInSecs:2)        timer.Event={      timer.pause()      //Process after finishing the timer}        timer.start()}}

Dispatch After - Delay

varindex=0GCDTimer.delay(2){    index+=1}

Installation

  • Addgithub "hemantasapkota/GCDTimer" to yourcartfile
  • Executecarthage update

Example

The example shows how to use GCDTimer to periodically poll newly submitted items from Hacker News.

ExampleSS

License

The MIT License (MIT)

Copyright (c) 2023 Hemanta Sapkota

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.

About

Well-tested GCD Timer in Swift

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp