GithubHelp home page GithubHelp logo

sytimer's Introduction

SYTimer

License MIT  CocoaPods  CocoaPods  Support  Build Status

SYTimer is a High performance library for timing. It provides you a chance to use it main runLoop or other runLoop in your next app.

Base on CFRunLoop Timer for iOS.

Features

  • All runLoop and runLoopMode Support.
  • It's only created two runLoop timer when in main runLoop.
  • It's based on priority queue wehn in main runLoop
  • ThreadSpecificVariable.
  • Heap and HeapItem.

SYTimer

The simplest use-case to setting an timer in main runLoop:

_timer = [SYTimer mainRunLoopTimerWithRunLoopMode:kCFRunLoopCommonModes block:^(SYTimer * _Nonnull) {
    // do 
}];
[_timer startRepeating:.5];

SYTimer will puted ther timer into the runLoopCommonModes heap and set runLoop timer next fire date.

other runLoop:

_otherRunLoopTimer = [[SYTimer alloc] initWithRunLoop:[SYRunLoop current] runLoopMode:kCFRunLoopCommonModes block:^(SYTimer * timer) {
    // do
}];
[_otherRunLoopTimer startRepeating:.5];

Just created runLoop timer and added to current runLoop.

SYHeap

See SYHeap code. It's contained min-heap and max-heap, INCREASE-KEY, DECREASE-KEY. It's used just like NSArray.

SYThreadSpecificVariable

A SYThreadSpecificVariable is a variable that can be read and set like a normal variable except that it holds different variables per thread.

SYHeapItem

An object which it's packaged as SYHeapItem and store it in a heap which it's SYHeap.

Installation

CocoaPods

  1. Add pod 'SYTimer' to your Podfile.
  2. Run pod install or pod update.
  3. Import <SYTimer/SYTimer.h>.

Requirements

This library requires iOS 10.0+ and Xcode 11.0+.

License

SYTimer is provided under the MIT license. See LICENSE file for details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.