{"id":31886866,"url":"https://github.com/xmartlabs/ecno","last_synced_at":"2025-10-13T05:51:36.312Z","repository":{"id":56909846,"uuid":"68133796","full_name":"xmartlabs/Ecno","owner":"xmartlabs","description":"Ecno is a task state manager built on top of UserDefaults in pure Swift 4.","archived":false,"fork":false,"pushed_at":"2020-03-23T13:02:43.000Z","size":63,"stargazers_count":100,"open_issues_count":0,"forks_count":10,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-10-12T18:06:47.379Z","etag":null,"topics":["ios","once","state","swift","task-manager","tasks","todolist","tutorial","userdefaults","welcome"],"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/xmartlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-13T18:02:27.000Z","updated_at":"2025-10-04T17:37:49.000Z","dependencies_parsed_at":"2022-08-21T04:20:34.108Z","dependency_job_id":null,"html_url":"https://github.com/xmartlabs/Ecno","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/xmartlabs/Ecno","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FEcno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FEcno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FEcno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FEcno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xmartlabs","download_url":"https://codeload.github.com/xmartlabs/Ecno/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FEcno/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013711,"owners_count":26085394,"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-10-13T02:00:06.723Z","response_time":61,"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":["ios","once","state","swift","task-manager","tasks","todolist","tutorial","userdefaults","welcome"],"created_at":"2025-10-13T05:51:34.919Z","updated_at":"2025-10-13T05:51:36.307Z","avatar_url":"https://github.com/xmartlabs.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\u003cimg src=\"Ecno.png\" style=\"margin: 0 auto; display: block\"/\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://travis-ci.org/xmartlabs/Ecno\"\u003e\u003cimg src=\"https://travis-ci.org/xmartlabs/Ecno.svg?branch=master\" alt=\"Build status\" /\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/platform-iOS-blue.svg?style=flat\" alt=\"Platform iOS\" /\u003e\n\u003ca href=\"https://developer.apple.com/swift\"\u003e\u003cimg src=\"https://img.shields.io/badge/swift5-compatible-4BC51D.svg?style=flat\" alt=\"Swift 5 compatible\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\" alt=\"Carthage compatible\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://cocoapods.org/pods/Ecno\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/Ecno.svg\" alt=\"CocoaPods compatible\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://raw.githubusercontent.com/xmartlabs/Ecno/master/LICENSE\"\u003e\u003cimg src=\"http://img.shields.io/badge/license-MIT-blue.svg?style=flat\" alt=\"License: MIT\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nBy \u003ca href=\"https://xmartlabs.com/\"\u003eXmartlabs SRL\u003c/a\u003e.\n\u003c/p\u003e\n\n## Introduction\n\n**Ecno** was inspired by [Once](https://github.com/jonfinerty/Once) Android library. It's a task state manager built on top of UserDefaults in pure Swift 4. This abstraction allows you to mark 'tasks' as done, 'to-do' and check for those states.  \n\n**Ecno** is ideal for:\n* Show tutorials once within the application.\n* Perform certain task periodically.\n* Trigger a task based on a user action.\n\n\n## Usage\n\nFirst you need to initialize it:\n\n```swift\nEcno.initialize()\n```\n\u003e Note: you should initialize it when your app gets launched.\n\nThen, you can check whether a task was done by:\n```swift\nif !Ecno.beenDone(\"task\") {\n  //...\n  Ecno.markDone(\"task\")\n}\n```\n\nAlso, you can check for specific requirements about a certain task:\n```swift\nif Ecno.beenDone(\"task\", scope: .appSession, numberOfTimes: .moreThan(3)) {\n  // do stuff\n}\n```\nor\n```swift\nif Ecno.beenDone(\"task\", scope: .since(20.minutes), numberOfTimes: .lessThan(3)) {\n  // do stuff\n}\n```\nAdditionally, you can program a 'to do' task by:\n```swift\nEcno.toDo(\"show banner\", scope: .until(3.hours), info: [\"name\": \"bannerName\"])\n```\nand then query if you need to do that task:\n```swift\nif Ecno.needToDo(\"show banner\") {\n  let info = Ecno.infoForToDo(\"show banner\") // [\"name\": \"bannerName\"]\n  // ...\n}\n```\n\n\n## Task\n\nAny type conforming to the `Task` protocol. Since it would be the most common case, the `String` type already conforms to `Task`.\n\n```swift\npublic protocol Task {\n\n    var tag: String { get }\n\n}\n```\n\n\n## Scope\n\nScopes represents periods of time within the application.\n\n* `.appInstall`  \nThis period represents all times for the application.\n* `.appVersion`  \nPeriod starting when the current version of the app was installed.\n* `.appSession`  \nPeriod starting when the application was launched.\n* `.since(TimeInterval)`  \nPeriod starting since `TimeInterval` time ago from now. For instance, `.since(2.days)`\n* `.until(TimeInterval)`  \nPeriod valid until `TimeInterval` from now. For instance, `.until(3.hours)`. This should be useful to set a 'to do' task that expires.\n\n## Functions\n\n* `func toDo(_ task: Task, scope: Scope? = nil, info: [AnyHashable: Any]? = nil)`  \nMarks a task as 'to do' within a given scope, if it has already been marked as to do or been done within that scope then it will not be marked. If the scope is nil, then it will be marked as to do anyways.\n* `func needToDo(_ task: Task) -\u003e Bool`  \nChecks if a task is currently marked as 'to do'.\n* `func infoForToDo(_ task: Task) -\u003e [AnyHashable: Any]?`  \nGets the info associated with a 'to do' task. (only if you provided it in the `toDo(...)` function)\n* `func lastDone(_ task: Task) -\u003e Date?`  \nLast done timestamp for a given task.\n* `func beenDone(_ task: Task, scope: Scope = .appInstall, numberOfTimes: CountChecker = .moreThan(0)) -\u003e Bool`  \nChecks if a task has been done with the given requirements.\n* `func markDone(_ task: Task)`  \nMarks a task as done.\n\n\n\n## Requirements\n\n* iOS 8.0+\n* Swift 4.0+\n* Xcode 9.0+\n\n## Getting involved\n\n* If you **want to contribute** please feel free to **submit pull requests**.\n* If you **have a feature request** please **open an issue**.\n* If you **found a bug** or **need help** please **check older issues**\n\nBefore contribute check the [CONTRIBUTING](https://github.com/xmartlabs/Ecno/blob/master/CONTRIBUTING.md) file for more info.\n\nIf you use **Ecno** in your app We would love to hear about it! Drop us a line on [twitter](https://twitter.com/xmartlabs).\n\n## Examples\n\nFollow these 3 steps to run Example project:\n\n* Clone Ecno repository\n* Open Ecno workspace and run the *Example* project.\n\n## Installation\n\n#### CocoaPods\n\n[CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects.\n\nTo install Ecno, simply add the following line to your Podfile:\n\n```ruby\npod 'Ecno', '~\u003e 3.0'\n```\n\n#### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a simple, decentralized dependency manager for Cocoa.\n\nTo install Ecno, simply add the following line to your Cartfile:\n\n```ogdl\ngithub \"xmartlabs/Ecno\" ~\u003e 3.0\n```\n\n## Author\n\n* [Diego Ernst](https://github.com/dernster)\n\n# Change Log\n\nThis can be found in the [CHANGELOG.md](CHANGELOG.md) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmartlabs%2Fecno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxmartlabs%2Fecno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmartlabs%2Fecno/lists"}