WWCountdownButton

main

A countdown button.
William-Weng/WWCountdownButton

WWCountdownButton

Swift-5.6 iOS-14.0 TAG Swift Package Manager-SUCCESS LICENSE

  • A countdown button.
  • 一個倒數計時的按鈕.

WWCountdownButton

dependencies: [
    .package(url: "https://github.com/William-Weng/WWCountdownButton.git", .upToNextMajor(from: "1.2.0"))
]

可用函式

函式 說明
countdown(second:isCountdown:displayType:preferredFramesPerSecond:reuslt:) 開始倒數 => 建議使用『等寬字型』
reset(displayType:) 回歸初始值 (歸零)
finish(displayType:) 直接設定為結束的狀態

Example

import UIKit
import WWPrint
import WWCountdownButton

final class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    @IBAction func countdown1(_ sender: WWCountdownButton) { sender.countdown(second: 6000, displayType: .hhmmss) }
    @IBAction func countdown2(_ sender: WWCountdownButton) { sender.countdown(second: 60, isCountdown: false) }
    @IBAction func countdown3(_ sender: WWCountdownButton) {
        sender.countdown(second: 5, displayType: .ss) { info in
            if (info.isFinish) { sender.backgroundColor = .darkGray }
            wwPrint(info)
        }
    }
}

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Oct 18 2024 16:37:11 GMT-0900 (Hawaii-Aleutian Daylight Time)