Code Monkey home page Code Monkey logo

lsttimer's Introduction

LSTTimer 性能和精度兼得的iOS计时器组件

Platform Language License CocoaPods Compatible

前言

  • 在项目开发中,计时器任务的需求很多, LSTTimer的出现就是为了更好统一管理项目中的计时器任务.
  • 欢迎coder们发现问题或者提供更好的idea,一起努力完善

博客地址

实现思路

LSTTimer单例设计, 内部持有一个NSTimer和计时任务池, 所有的计时任务都被添加到任务池里面; NSTimer每100ms(毫秒)执行一次遍历计时任务池, 每个计时任务会进行的时间差运算.

特性

  • 提供丰富的api,简单入手使用
  • 单例设计,安全且占用内存少,统一管理app所有计时任务
  • 单计时器任务池设计,一个NSTimer完成多个计时任务
  • 计时任务精确度:100ms(100毫秒)
  • 支持计时格式--> 天:时:分:秒:毫秒
  • 支持硬盘持久化计时任务
  • 支持列表计时任务和各种花里胡哨的计时任务

版本更新历史点我

安装

  • CocoaPods安装: 在podfile文件中添加以下描述,然后 pod install 或者 pod update

    pod 'LSTTimer'
  • Carthage安装:(暂时未适配)

效果演示(gif图比较大,请耐心等待~)

  • 应用市场常用的示例场景
    • 支持 天:时:分:秒:毫秒
    • 列表计时方案:只需一个计时任务
常用示例场景
图片名称
列表倒计时
图片名称
  • 内存计时任务 (当前页面添加计时任务,退出当前页面,计时任务不会停止,而是存在于app的整个生命周期内.当然了,也可以手动移除)
内存计时任务
图片名称
  • 硬盘计时任务

(当前页面添加硬盘计时任务,退出app,计时任务保存在硬盘,再次打开进入app,如果计时任务没有结束,继续该计时任务)

自动规避键盘遮挡
图片名称

作者

[email protected], [email protected]

版权

尊重劳动成果, 人人有责.

lsttimer's People

Contributors

losentrad avatar

Watchers

James Cloos avatar

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.