{"id":17934063,"url":"https://github.com/jonnybeegod/restorablecountdown","last_synced_at":"2025-04-03T11:17:31.860Z","repository":{"id":100667725,"uuid":"229407748","full_name":"JonnyBeeGod/RestorableCountdown","owner":"JonnyBeeGod","description":"Native Timer-based Countdown written in Swift","archived":false,"fork":false,"pushed_at":"2019-12-31T04:47:48.000Z","size":86,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T00:41:36.095Z","etag":null,"topics":["countdown","countdown-timer","countdowntimer","ios","swift","swift-package-manager","timer"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JonnyBeeGod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-21T09:51:45.000Z","updated_at":"2023-08-10T08:54:50.000Z","dependencies_parsed_at":"2023-05-16T16:00:09.532Z","dependency_job_id":null,"html_url":"https://github.com/JonnyBeeGod/RestorableCountdown","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonnyBeeGod%2FRestorableCountdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonnyBeeGod%2FRestorableCountdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonnyBeeGod%2FRestorableCountdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonnyBeeGod%2FRestorableCountdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JonnyBeeGod","download_url":"https://codeload.github.com/JonnyBeeGod/RestorableCountdown/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246989752,"owners_count":20865331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["countdown","countdown-timer","countdowntimer","ios","swift","swift-package-manager","timer"],"created_at":"2024-10-28T21:43:55.863Z","updated_at":"2025-04-03T11:17:31.834Z","avatar_url":"https://github.com/JonnyBeeGod.png","language":"Swift","readme":"# Restorable Countdown\n\n![](https://github.com/JonnyBeeGod/RestorableCountdown/workflows/Swift/badge.svg)\n[![codecov](https://codecov.io/gh/JonnyBeeGod/RestorableCountdown/branch/master/graph/badge.svg?token=y21zGNAsLL)](https://codecov.io/gh/JonnyBeeGod/RestorableCountdown)\n\u003cimg src=\"https://img.shields.io/badge/Swift-5.1-orange.svg\" /\u003e\n\u003ca href=\"https://swift.org/package-manager\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/swiftpm-compatible-brightgreen.svg?style=flat\" alt=\"Swift Package Manager\" /\u003e\n\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/platforms-iOS+macOS+tvOS+watchOS-brightgreen.svg?style=flat\" alt=\"Mac + Linux\" /\u003e\n\u003ca href=\"https://twitter.com/jonezdotcom\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/twitter-@jonezdotcom-blue.svg?style=flat\" alt=\"Twitter: @jonezdotcom\" /\u003e\n\u003c/a\u003e\n\nRestorable Countdown is a convenient framework for managing long running countdowns written in Swift for Cocoa. \n\n# What does it do?\nRestorable Countdown allows for managing very long running timers and countdowns. It is a wrapper around Swift Foundations `Timer` class and gracefully saves and restores its state when the application goes into background by hooking in the `UApplicationDelegate` / `NSApplicationDelegate` lifecycle methods. Restorable Countdown is compatible with all four relevant platforms iOS / iPadOS, macOS, tvOS and watchOS. It also supports sending local notifications on completion. \n\n# How to install?\nRestorable Countdown is compatible with Swift Package Manager. To install, simply add this repository URL to your swift packages as package dependency in Xcode. \nAlternatively, add this line to your `Package.swift` file:\n\n```\ndependencies: [\n    .package(url: \"https://github.com/JonnyBeeGod/RestorableCountdown\", from: \"0.1.0\")\n]\n```\n\nAnd don't forget to add the dependency to your target(s). \n\n# How to use?\n1. Initialize a `CountdownConfiguration` and configure it to your needs. As a start you can also use the predefined values and go from here.\n2. Create a `Countdown` object and feed it the configuration from step 1 and a `CountdownDelegate`\n3. Call `startCountdown()` \n\n## Notifications\nInject a `UNUserNotificationCenter` as well as a `UNUserNotificationContent` object on initialization if you want to schedule a local notification when the countdown has finished. Make sure that you have asked for user permissions before, see [here](https://developer.apple.com/documentation/usernotifications/asking_permission_to_use_notifications).\n\n# Caveats\n- [ ] Currently no background execution supported meaning that the countdown will stop firing and executing code as soon as the app is in the background. When the app goes into foreground again the timer resumes and / or finishes. \n\nThe reason for this is that the options we get from Apple for executing code in the background are very limited and have gotten even more restrictive in the past. I was previously using means to extend background execution time as described [here](https://developer.apple.com/documentation/uikit/app_and_environment/scenes/preparing_your_ui_to_run_in_the_background/extending_your_app_s_background_execution_time), but discovered that this is not a solution for very long running timers over a couple of minutes. Modes for background execution might be added later but will probably only be possible with some limitations as or the reasons described above. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonnybeegod%2Frestorablecountdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonnybeegod%2Frestorablecountdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonnybeegod%2Frestorablecountdown/lists"}