• Stars
    star
    190
  • Rank 203,739 (Top 5 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Well-tested GCD Timer in Swift

Carthage compatible

GCDTimer

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

Usage

Long running timer

import GCDTimer

class Demo {

  init() {
    let timer = 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 GCDTimer

class Demo {

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

Dispatch After - Delay

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

Installation

  • Add github "hemantasapkota/GCDTimer" to your cartfile
  • Execute carthage 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 copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

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

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 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 THE SOFTWARE.

More Repositories

1

SwiftStore

Key-Value store for Swift backed by LevelDB
C++
124
star
2

insta

Instagram power tool
Go
57
star
3

FlatUIColorPaletteXCode

FlatUI Colors palette for XCode
54
star
4

OpenSansSwift

Easily use the OpenSans font in Swift
Swift
41
star
5

j2objc-eclipse-plugin

Eclipse plugin for Google's J2OBJC - A Java to iOS Objective-C translation tool and runtime.
Java
26
star
6

djangobot

curl for django web framework. Make authenticated requests to a django server.
Go
21
star
7

SwiftListView

Instagram style - Collection of simple & neutral list views for Swift
Swift
16
star
8

go-convexhull

Implementation of Graham Scan algorithm for Convex Hull in GO with visualization
Go
16
star
9

awesome-essays

Listen to a curated collection of essays via. text-to-speech
Go
11
star
10

react-native-webserver

An embeddable dynamic web-server for React Native.
Objective-C
10
star
11

goma

Build native mobile apps faster: Write logic in GO. Views in ReactNative.
Go
10
star
12

Embed-Lua-Java-Box2D

Tutorial - How to embed Lua in Java. Example with LibGDX and Box2D
Java
10
star
13

sloot-editor

Box2D Editor with support for entities, animation, screens and scripting.
Java
9
star
14

JSQMessagesViewController

Carthage support for https://github.com/jessesquires/JSQMessagesViewController.
Objective-C
7
star
15

MakeAppIcon

CLI tool to make app icons for IOS and Android
Go
3
star
16

social-media-for-aid-awareness

Generating foreign aid awareness using visualization and social media - A demonstration for Aid Barcamp, KTM 4th August 2011 (GWT, Google Dataset Publishing Language)
Java
3
star
17

TablessNavigationTemplate

Tutorial - Gmail/Facebook like menu navigation structure for IOS.
Objective-C
3
star
18

ogg-preview

Preview OGG files in Atom Editor
CoffeeScript
3
star
19

codeplayground

Support for Go Playground
2
star
20

wikipedia-image-downloader

Give it a list of words and it'll download the images from wikipedia for you.
Go
2
star
21

socketcluster-client

Socket Cluster Client for Golang, IOS, & Android.
JavaScript
2
star
22

ofxPhysicsEditorBox2D

Load fixtures generated by Physics Editor (https://www.codeandweb.com/physicseditor) in OpenFrameworks
Objective-C++
2
star
23

ofAndroidclipse

Eclipse plugin for creating @OpenFrameworks projects for Android
Java
1
star
24

pdfspeaker

Start listening to your pdf files (experimental)
JavaScript
1
star
25

XCodeColorPaletteMaker

XCode color palette (.CLR) file maker
Objective-C
1
star
26

mixpanel-swift

Swift wrapper for MixPanel IOS library with support for Carthage.
Objective-C
1
star
27

myAlgos

Algorithmic Thinking in Golang
Go
1
star
28

LaexianFirstFive

Chrome Extension - Open your favorite websites in Google Chrome with a click.
1
star
29

DockerBeanstalkSample

Hello World in Golang served with Docker. Deployable to AWS Beanstalk.
Go
1
star
30

SampleScrollViewControllerAutoLayout

Sample Scroll View Controller with Auto Layout using SnapKit - https://github.com/SnapKit/SnapKit
Swift
1
star