{"id":17998997,"url":"https://github.com/sam-spencer/lurker","last_synced_at":"2025-08-26T16:10:42.546Z","repository":{"id":63920454,"uuid":"476874264","full_name":"Sam-Spencer/Lurker","owner":"Sam-Spencer","description":"Abstraction over the iOS BackgroundTask API to make background tasks easy to isolate, maintain and schedule.","archived":false,"fork":false,"pushed_at":"2022-12-11T00:31:38.000Z","size":2397,"stargazers_count":53,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-21T08:07:16.890Z","etag":null,"topics":["async-await","background-tasks","background-worker","concurrency","ios","scheduler","swift"],"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/Sam-Spencer.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}},"created_at":"2022-04-01T21:33:27.000Z","updated_at":"2025-08-19T15:51:54.000Z","dependencies_parsed_at":"2023-01-14T14:00:37.323Z","dependency_job_id":null,"html_url":"https://github.com/Sam-Spencer/Lurker","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Sam-Spencer/Lurker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sam-Spencer%2FLurker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sam-Spencer%2FLurker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sam-Spencer%2FLurker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sam-Spencer%2FLurker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sam-Spencer","download_url":"https://codeload.github.com/Sam-Spencer/Lurker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sam-Spencer%2FLurker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272235758,"owners_count":24897261,"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","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["async-await","background-tasks","background-worker","concurrency","ios","scheduler","swift"],"created_at":"2024-10-29T22:09:36.908Z","updated_at":"2025-08-26T16:10:42.477Z","avatar_url":"https://github.com/Sam-Spencer.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n \u003cimg src=\"https://github.com/Sam-Spencer/Lurker/raw/main/hero-icon.png\" width=\"128\" align=\"center\"\u003e\n \u003cbr/\u003e\n \u003ch1 align=\"center\"\u003eLurker\u003c/h1\u003e\n \u003cp align=\"center\"\u003eA dead-simple abstraction over the \u003ca href=\"https://developer.apple.com/documentation/backgroundtasks\"\u003eiOS BackgroundTask API\u003c/a\u003e to make background tasks easy to isolate, maintain and schedule. Designed to be as lightweight and flexible as possible while tightly integrating with the system APIs. \u003ci\u003eAnd\u003c/i\u003e It's built with Swift Concurrency in mind.\u003c/p\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\n## Features\n\n - [x] Isolates and abstracts background tasks\n - [x] Eliminates boilerplate and extra setup steps\n - [x] Supports Swift Concurrency / async await\n - [x] Low-overhead and full feature set\n - [x] Extensive documentation (available with DocC)\n \n## Requirements\nThis package requires a minimum deployment target of iOS 13.0 and Swift 5.6.\n\n## Installation\nYou can install, or integrate, Lurker using [Swift Package Manager](https://github.com/apple/swift-package-manager) or manually. \n\n### Swift Package Manager\nCopy the following URL and then from Xcode choose `File` \u003e `Add Packages...`.\n\n    https://github.com/Sam-Spencer/Lurker.git\n    \n### Manually\nClone or download the repository and copy the contents of the `Sources` directory into your project.\n\n## Getting Started\nLurker provides stellar documentation to walk you through every step of the way and any questions you may have. But, I've also included a quick reference to get you going here.\n\n### Registering \u0026 Scheduling Tasks\nRegistering and scheduling your tasks can be as short as two lines of code. Just make sure to call Lurker's `registerMissions` function before your app finishes launching.\n\n  1. Register your \"missions\" (background tasks).\n  2. Schedule them.\n  3. All done! 🍾\n\n```swift\nfunc setupLurker() {\n    do {\n        try Lurker.shared.registerMissions([ProductMission(), ConfigurationMission()])\n        Lurker.shared.scheduleAllMissions()\n    } catch let error {\n        print(\"Failed to register and schedule background tasks: \\(error)\")\n    }\n}\n```\n\n\u003e **Important**: Any errors thrown here are likely programmer errors and should be resolved prior to deployment to production.\n\n### Creating a Task\nCreating a task is pretty easy. Just create an object that conforms to the `Mission` protocol and implement the necessary properties and functions.\n\n```swift\nfinal class ConfigurationMission: Mission {\n    \n    // This should match one of your app's predefined task identifier\n    var identifier: String {\n        return \"com.yourApp.backgroundRefresh.configurationTask\"\n    }\n    \n    // This can be either \"brief\" or \"extended\"\n    var style: MissionStyle {\n        return .extended\n    }\n    \n    // This is where the magic happens!\n    func runTask(_ taskInfo: BGTask) async -\u003e Bool {\n        let longTask = Task { _ -\u003e Bool in\n            // Perform work here\n            return true\n        }\n        \n        taskInfo.expirationHandler = {\n            print(\"Task is expiring\")\n            longTask.cancel()\n        }\n        \n        let success = await longTask.value\n        return success\n    }\n    \n    // Return a date here to delay system task execution\n    func earliestStart() -\u003e Date? {\n        return nil\n    }\n    \n}\n```\n\n\u003e **Tip**: The `Mission` protocol requires [`Sendable` conformance](https://www.avanderlee.com/swift/sendable-protocol-closures/). The easiest way to ensure this is by using either a `struct` or `final class`, depending on your needs. Otherwise you may need to do extra work to conform.\n\n### Documentation\nExtensive, beautiful documentation is available by importing the included `.doccarchive` bundle into Xcode. Just open the archive and Xcode will import it into your documentation browser. Documentation includes articles to get you up and running with Background Tasks and information on how to debug these tasks.\n\n![Documentation Screenshot](https://github.com/Sam-Spencer/Lurker/raw/main/hero-documentation.png)\n\n## License\nLurker is available under the MIT license. See LICENSE file for more info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam-spencer%2Flurker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsam-spencer%2Flurker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam-spencer%2Flurker/lists"}