GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - osmanyildirim/OYTimer: Swift SDK of Timer with Countdown, Repeat and After types

BranchesTags
Open more actions menu

Latest commit

 

History

4 Commits
4 Commits

Folders and files

NameName
Last commit message
Last commit date
Assets
Assets
 
 
Sources
Sources
 
 
LICENSE
LICENSE
 
 
OYTimer.podspec
OYTimer.podspec
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 

Repository files navigation

Cocoapods SPM compatible Platforms Swift Xcode MIT

Swift SDK of Timer with Countdown, Repeat and After types

Contents

  • Requirements
  • Installation
  • Usage
    • After
    • Countdown
    • Repeat
  • License

Requirements

  • iOS 11.0+
  • Swift 5.0+

Installation

CocoaPods

Add the following line to your Podfile

pod 'OYTimer'
Swift Package Manager

Add OYTimer as a dependency to your Package.swift and specify OYTimer as a target dependency

import PackageDescription
  
let package = Package(
    name: "YOUR_PROJECT_NAME",
    targets: [],
    dependencies: [
        .package(url: "https://github.com/osmanyildirim/OYTimer", .upToNextMinor(from: "1.0")),
    ],
    targets: [
        .target(
            name: "YOUR_PROJECT_NAME",
            dependencies: ["OYTimer"])
    ]
)

Usage

After

let timer = OYTimer(type: .after(5.second_s), interval: 1.second_s)

timer.start { [weak self] state, _, _ in
    if case .completed = state {
        // do stuff
    }
}

Countdown

The timer will be invalidate when state is .completed

let timer = OYTimer(type: .countdown(1.minute_s), interval: 1.second_s)

timer.start { [weak self] state, _, remaining in
    if case .ticking = state {
        print(remaining)
    } else if case .completed = state {
        // do stuff
    }
}

Repeat

let timer = OYTimer(type: .repeat, interval: 1.second_s)

timer.start { [weak self] state, counter, _ in
    if case .ticking = state {
        print(counter)
    }

    if counter == 20 {
        timer.stop()
    }
}

License

OYTimer is released under an MIT license. See LICENSE for details.

About

Swift SDK of Timer with Countdown, Repeat and After types

Topics

countdownswifttimer

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.