{"id":20037996,"url":"https://github.com/perfectlysoft/perfect-repeater","last_synced_at":"2025-06-19T13:39:53.032Z","repository":{"id":63920177,"uuid":"84233249","full_name":"PerfectlySoft/Perfect-Repeater","owner":"PerfectlySoft","description":"A simple library that takes a closure and executes it at the specified interval until the closure returns false or the application is terminated.","archived":false,"fork":false,"pushed_at":"2019-04-22T17:11:55.000Z","size":9,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-22T17:19:20.934Z","etag":null,"topics":["server-side-swift","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PerfectlySoft.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":"2017-03-07T18:37:48.000Z","updated_at":"2019-06-21T06:31:23.000Z","dependencies_parsed_at":"2023-01-14T14:00:32.291Z","dependency_job_id":null,"html_url":"https://github.com/PerfectlySoft/Perfect-Repeater","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/PerfectlySoft/Perfect-Repeater","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Repeater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Repeater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Repeater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Repeater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PerfectlySoft","download_url":"https://codeload.github.com/PerfectlySoft/Perfect-Repeater/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PerfectlySoft%2FPerfect-Repeater/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260760405,"owners_count":23058592,"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":["server-side-swift","swift"],"created_at":"2024-11-13T10:24:35.180Z","updated_at":"2025-06-19T13:39:48.015Z","avatar_url":"https://github.com/PerfectlySoft.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Perfect Repeater\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"http://perfect.org/get-involved.html\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://perfect.org/assets/github/perfect_github_2_0_0.jpg\" alt=\"Get Involed with Perfect!\" width=\"854\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/PerfectlySoft/Perfect\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_1_Star.jpg\" alt=\"Star Perfect On Github\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"http://stackoverflow.com/questions/tagged/perfect\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/perfect_gh_button_2_SO.jpg\" alt=\"Stack Overflow\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"https://twitter.com/perfectlysoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_3_twit.jpg\" alt=\"Follow Perfect on Twitter\" /\u003e\n    \u003c/a\u003e  \n    \u003ca href=\"http://perfect.ly\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://www.perfect.org/github/Perfect_GH_button_4_slack.jpg\" alt=\"Join the Perfect Slack\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat\" alt=\"Swift 4.0\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://developer.apple.com/swift/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Platforms-OS%20X%20%7C%20Linux%20-lightgray.svg?style=flat\" alt=\"Platforms OS X | Linux\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.org/licensing.html\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-Apache-lightgrey.svg?style=flat\" alt=\"License Apache\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://twitter.com/PerfectlySoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Twitter-@PerfectlySoft-blue.svg?style=flat\" alt=\"PerfectlySoft Twitter\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://perfect.ly\" target=\"_blank\"\u003e\n        \u003cimg src=\"http://perfect.ly/badge.svg\" alt=\"Slack Status\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nThe Perfect \"Repeater\" is a simple library that takes a closure and executes it at the specified interval until the closure returns false or the application is terminated.\n\nNote that a demo is located at [https://github.com/PerfectExamples/Perfect-Repeater-Demo](https://github.com/PerfectExamples/Perfect-Repeater-Demo) that shows the operation of the library.\n\n## Compatibility with Swift\n\nThe master branch of this project currently compiles with **Xcode 9** or the **Swift 4** toolchain on Ubuntu, and is compatible with both Perfect 2.x and 3.x\n\n## Building\n\nAdd this project as a dependency in your Package.swift file.\n\n``` swift\n.Package(url:\"https://github.com/PerfectlySoft/Perfect-Repeater.git\", majorVersion: 1)\n```\n\n## Usage\n\nInclude in your file the import statement:\n\n``` swift\nimport PerfectRepeater\n```\n\nThe base form of executing this is:\n\n``` swift \nRepeater.exec(timer: \u003cDouble\u003e, callback: \u003cClosure\u003e)\n```\n\nTo demonstrate the process of repeating a closure containing your code and optionally re-queuing:\n\n``` swift\nvar opt = 1\n\nlet c = {\n\t() -\u003e Bool in\n\tprint(\"XXXXXX\")\n\treturn true\n}\nlet cc = {\n\t() -\u003e Bool in\n\tprint(\"Hello, world! (\\(opt))\")\n\tif opt \u003c 10 {\n\t\topt += 1\n\t\treturn true\n\t} else {\n\t\tprint(\"cc exiting.\")\n\t\treturn false\n\t}\n}\n\nRepeater.exec(timer: 3.0, callback: c)\nRepeater.exec(timer: 2.0, callback: cc)\n```\n\n## Further Information\nFor more information on the Perfect project, please visit [perfect.org](http://perfect.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectlysoft%2Fperfect-repeater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperfectlysoft%2Fperfect-repeater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfectlysoft%2Fperfect-repeater/lists"}