Giter VIP home page Giter VIP logo

magictimerfw / magictimer Goto Github PK

View Code? Open in Web Editor NEW
162.0 2.0 18.0 126 KB

Welcome to the MagicTimer framework, your ultimate solution for handling timers in your iOS applications. This framework provides a powerful and flexible timer implementation with various features to meet your timer needs.

License: MIT License

Swift 94.74% Ruby 5.26%
timer countdown-timer countup-timer swift stopwatch countdown ios

magictimer's People

Contributors

mohammadrezaansari avatar sadeghgoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

magictimer's Issues

24 Hours to above issue

when i pass time 24 hour to above then other value(time) pass

when i pass below 24 hours then it work proper

Exception when iOS app running on M1 Mac

2021-04-15 17:51:36.250058+0500 KickSharing[41952:669837] MagicTimer: initialized
2021-04-15 17:51:36.253818+0500 KickSharing[41952:669837] *** Assertion failure in -[MagicTimer.MGStandardTimerFormatter setAllowedUnits:], NSDateComponentsFormatter.m:806
2021-04-15 17:51:36.260599+0500 KickSharing[41952:669837] [General] Invalid parameter not satisfying: allowedUnits == 0 || !(allowedUnits & ~(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitWeekOfMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond))

Continue countdown timer after being paused

Hello!

Thanks for this library, it has helped me a lot! I have one problem. I have implemented a timer in my app and use 3 button to control this timer: Start, Stop and Pause. The problem is that when user presses Pause the timer pauses, but when the user presses Start, it doesn't continue running from where it was paused, because I don't know how to do that. Here is my code:

`import UIKit
import MagicTimer

class TimerVC: UIViewController {

var currentTaskDefaultTime = 10.0


@IBOutlet weak var timer: MagicTimerView!

@IBOutlet weak var startButton: UIButton!

@IBOutlet weak var pauseButton: UIButton!

@IBOutlet weak var stopButton: UIButton!

@IBAction func pressedStartButton(_ sender: Any) {
    startButton.isHidden = true
    pauseButton.isHidden = false
    stopButton.isHidden = false
    
    timer.mode = .countDown(fromSeconds: currentTaskDefaultTime)
    timer.isActiveInBackground = true
    timer.startCounting()
    
    
    
}

@IBAction func pressedPauseButton(_ sender: Any) {
    timer.stopCounting()
    startButton.isHidden = false
    completeTaskButton.isHidden = true
}

@IBAction func pressedStopButton(_ sender: Any) {
    timer.resetToDefault()
    startButton.isHidden = false
    pauseButton.isHidden = true
    stopButton.isHidden = true
}



override func viewDidLoad() {
    super.viewDidLoad()
    
    timer.font = UIFont(name: "Comfortaa-Semibold", size: 50)
    
    //hides by default the buttons
    pauseButton.isHidden = true
    stopButton.isHidden = true
}

}
`

Please help me

Sincerely yours
Nurlan

can using pod

I think you need update the REAMDE this line:

  pod 'MagicTimer', :git => 'https://github.com/MagicTimerFW/MagicTimer'

Custom text formatter

Is there any way currently to provide a custom formatter to for the displayed text?

Cannot Add Package via SPM in Xcode 15 Beta 3

Hi! Thanks for the work you've put in to maintaining this library, I know it's going to save me a ton of time.

Summary

  • Cannot add version of MagicTimer via Swift Package Manager
  • Error SPM: Failed to resolve dependencies Dependencies could not be resolved because package 'magictimer' is required using a stable-version but 'magictimer' depends on an unstable-version package 'magictimercore' and root depends on 'magictimer' 2.0.1.. <3.0.0.

Environment

  • Xcode Version 15.0 beta 3 (15A5195k)
  • Build target iOS 17+

About countdown

There is an error in the countdown time return, and it does not stop when the time reaches completion。

func start() {
        timer.countMode = .countDown(fromSeconds: 60)
        timer.defultValue = 0
        timer.effectiveValue = 1
        timer.timeInterval = 1
        timer.isActiveInBackground = true

        // Set up event handlers
        timer.lastStateDidChangeHandler = { state in
            print("Timer state changed: \(state)")
        }

        timer.elapsedTimeDidChangeHandler = { elapsedTime in
            print("Elapsed time updated: \(elapsedTime)")
        }

        // Start the timer
        timer.start()
    }

didStateChange Callback is Not Firing on Stop

Hi,

I am calling callback on viewdidload like that

  timer.defaultValue = 10
  timer.isActiveInBackground = true
  timer.mode = .countDown(fromSeconds: 10)
  timer.startCounting()

  timer.didStateChange = { (timer_state) -> Void in
                    print(timer_state)
                }
        

The callback works on start and prints state as fired but on stop the callback is not working and never firing.

Am I doing something wrong or it is a kind of a bug ?

thanks

.countDown(fromSeconds: 60) doesnt work at all for 1.0.6 version.

Here is my code:

        timer.countMode = .countDown(fromSeconds: 60)
        timer.defultValue = 0
        timer.effectiveValue = 1
        timer.timeInterval = 1
        timer.isActiveInBackground = true
        print(">>>>>int: \(interval)")
        timer.lastStateDidChangeHandler = { state in
            print(">>>>>>>state")
            print(state)
        }
        timer.elapsedTimeDidChangeHandler = { [weak self] elapsedTime in
            print(">>>>>>>statetime")
            print(elapsedTime)
            if elapsedTime == 0 {
                self?.onComplete?()
            }
        }
//        timer.resetToDefault()
        timer.start()

It prints 59.0 every second. Why? Doesnt change anything.

[!] Unable to find a specification for `MagicTimer`

While using pod 'MagicTimer' I'm getting the following error

**[!] Unable to find a specification for MagicTimer

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
  • mistyped the name or version.
  • not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.**

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.