{"id":18801236,"url":"https://github.com/ptsochantaris/maintini","last_synced_at":"2026-05-04T13:31:12.853Z","repository":{"id":189018802,"uuid":"679871142","full_name":"ptsochantaris/maintini","owner":"ptsochantaris","description":"A friendly and efficient wrapper to protect iOS app operations for a short time when backgrounded.","archived":false,"fork":false,"pushed_at":"2024-10-09T20:13:13.000Z","size":23,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-23T01:41:55.378Z","etag":null,"topics":["background","convenience","ios","lifecycle","macos","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/ptsochantaris.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,"zenodo":null},"funding":{"github":"ptsochantaris"}},"created_at":"2023-08-17T20:04:00.000Z","updated_at":"2025-11-04T06:19:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"540ab29d-63ca-4191-b0fe-007037b2a52e","html_url":"https://github.com/ptsochantaris/maintini","commit_stats":null,"previous_names":["ptsochantaris/maintini"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ptsochantaris/maintini","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptsochantaris%2Fmaintini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptsochantaris%2Fmaintini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptsochantaris%2Fmaintini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptsochantaris%2Fmaintini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ptsochantaris","download_url":"https://codeload.github.com/ptsochantaris/maintini/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptsochantaris%2Fmaintini/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32609332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["background","convenience","ios","lifecycle","macos","swift"],"created_at":"2024-11-07T22:22:57.607Z","updated_at":"2026-05-04T13:31:12.826Z","avatar_url":"https://github.com/ptsochantaris.png","language":"Swift","funding_links":["https://github.com/sponsors/ptsochantaris"],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://ptsochantaris.github.io/trailer/MaintiniLogo.webp\" alt=\"Logo\" width=256 align=\"right\"\u003e\n\n# Maintini\n\nA friendly and efficient wrapper for wrapping operations so that:\n- iOS: Keep the app active for a short time when backgrounded.\n- macOS: Ask the system not to go into idle sleep if possible.\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fptsochantaris%2Fmaintini%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/ptsochantaris/maintini) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fptsochantaris%2Fmaintini%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/ptsochantaris/maintini)\n\nCurrently used in\n- [Trailer](https://github.com/ptsochantaris/trailer)\n- [Gladys](https://github.com/ptsochantaris/gladys)\n- [Mima](https://github.com/ptsochantaris/mima)\n\nDetailed docs [can be found here](https://swiftpackageindex.com/ptsochantaris/maintini/documentation)\n\n## Overview\n\n- Calls can be nested around any critical section, and Maintini only calls out to the OS task APIs if needed, so these calls are very cheap.\n- Maintini will keep the OS from suspending the app, or sleeping, as long as possible if there is at least one session present.\n- If the last session exits on iOS, and the app is in the background, it will be suspended a couple of seconds later.\n- iOS places a hard limit on the amount of time allowed, and the app will be suspended at the end of that period no matter what. Completing API calls, short data transfers, or sync operations are the kind of thing Maintini is designed for. For longer running operations please refer to Apple's Background Task scheduling API instead.\n\n```\nMaintini.setup() // Always call this at app launch to set things up\n...\n\nfunc anExampleWithABlockCall() async {\n    await Maintini.maintain {\n        await processingThatShouldNotBeInterrupted()\n    }\n}\n\nfunc anExampleWithADeferredCall() async {\n    Maintini.startMaintaining()\n    defer {\n        Maintini.endMaintaining()\n    }\n    await processingThatShouldNotBeInterrupted()\n}\n\nfunc anExampleWithNestedCalls() async {\n    Maintini.startMaintaining()\n\n    Task {\n        await processingThatShouldNotBeInterrupted()\n\n        await anExampleWithADeferredCall()\n\n        await anExampleWithABlockCall()\n\n        Maintini.endMaintaining()\n    }\n}\n\n```\n\n## License\nCopyright (c) 2023 Paul Tsochantaris. Licensed under the MIT License, see LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptsochantaris%2Fmaintini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fptsochantaris%2Fmaintini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptsochantaris%2Fmaintini/lists"}