Giter Site home page Giter Site logo

hassan-shahbazi / srcountdowntimer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rsrbk/srcountdowntimer

0.0 1.0 0.0 967 KB

This is the simple circle countdown with a configurable timer for iOS.

License: MIT License

Ruby 5.20% Swift 94.80%

srcountdowntimer's Introduction

SRCountdownTimer Pod status

This is the simple circle countdown with a configurable timer

Demo gif

Installation

The most preferable way to use this library is cocoapods. Add the following line to your Podfile:

pod 'SRCountdownTimer'

and run pod install in your terminal.

Alternatively, you can manually add the files in the SRCountdownTimer directory to your project.

Usage

Create a custom instance of SRCountdownTimer(subclass of UIView) using the storyboard or directly in the code.

You can customize different properties:

public var lineWidth: CGFloat = 2.0
public var lineColor: UIColor = .black
public var trailLineColor: UIColor = UIColor.lightGray.withAlphaComponent(0.5)

public var isLabelHidden: Bool = false
public var labelFont: UIFont?
public var labelTextColor: UIColor?
public var timerFinishingText: String?

The last(timerFinishingText) means the text that will be shown after timer expires. If nil - it'll show the current counter value(0).

Use this method to start the countdown:

public func start(beginingValue: Int, interval: TimeInterval = 1)

To pause:

public func pause()

To resume(will start from the current state of view)

public func resume()

SRCountdownTimerDelegate

@objc optional func timerDidUpdateCounterValue(newValue: Int)
@objc optional func timerDidStart()
@objc optional func timerDidPause()
@objc optional func timerDidResume()
@objc optional func timerDidEnd()

What's new in 1.1 version

  • Added delegate call when a timer has finished
  • Added label text color customization
  • Added possibility to show minutes and seconds as the remaining time
  • Carthage Compatibility
  • IBInspectable attributes for the customization
  • iOS 9 support
  • Fixed a bug for the scrollview interaction

Thanks @nappannda, @nudaya, @Hamid1993, @SirWellington, @samir105, @resand, @rodmaz for all your contribution and PRs!

Shoutout

This was inspired by https://github.com/johngraham262/JWGCircleCounter

License

MIT License

Copyright (c) 2017 Ruslan Serebriakov [email protected]

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.

srcountdowntimer's People

Contributors

ayumu838 avatar hamid1993 avatar nappannda avatar nudaya avatar rsrbk avatar samir105 avatar sirwellington avatar

Watchers

 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.