{"id":22962326,"url":"https://github.com/zonble/activedays","last_synced_at":"2025-08-13T06:33:49.886Z","repository":{"id":56901504,"uuid":"132740860","full_name":"zonble/ActiveDays","owner":"zonble","description":null,"archived":false,"fork":false,"pushed_at":"2018-05-14T07:35:43.000Z","size":108,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-01T10:51:12.925Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zonble.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":"2018-05-09T10:30:15.000Z","updated_at":"2018-05-15T02:51:25.000Z","dependencies_parsed_at":"2022-08-20T18:20:33.452Z","dependency_job_id":null,"html_url":"https://github.com/zonble/ActiveDays","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonble%2FActiveDays","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonble%2FActiveDays/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonble%2FActiveDays/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zonble%2FActiveDays/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zonble","download_url":"https://codeload.github.com/zonble/ActiveDays/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229743813,"owners_count":18117460,"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":[],"created_at":"2024-12-14T19:16:33.611Z","updated_at":"2024-12-14T19:16:34.309Z","avatar_url":"https://github.com/zonble.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ActiveDays\n\n\nWeizhong Yang (a.k.a zonble)\n\nActiveDays is a Swift module, which turns how active a user is in a week into events which could be sent to Analytics platforms such as Firebase, Microsoft AppCenter and so on.\n\n## Usage\n\nWhen we want to measure how our users are engaged with our app, we may want to know how many days are they using in a week - How many users use our app only for one day, or seven days a week?\n\nFor example, if we want to know how many days does a user launch our app, we may create an instance of ActiveDaysPerWeekCounter, and start a session\n\n``` swift\n    let activeDaysCounter = ActiveDaysPerWeekCounter(settingKey: \"app-launch\")\n    activeDaysCounter.startNewSessionIfNoExitingOne()\n```\n\nThen, pass a date to the ActiveDaysPerWeekCounter instance, it will tell you if you should send an event or not.\n\n``` swift\n    let result = try! activeDaysCounter.commit(accessDate: Date())\n    if case let .active(days) = result {\n        // Send active days to your analytics platform here.\n    }\n```\n\n## Installation\n\nYou can only install the extension with Swift Package Manager right now. Please add\n\n``` swift\n    // swift-tools-version:4.0\n\n    import PackageDescription\n\n    let package = Package(\n        name: \"YourTargetName\",\n        products: [\n            .executable(name: \"YourTargetName\", targets: [\"YourTargetName\"])\n        ],\n        dependencies: [\n            .package(url: \"https://github.com/zonble/ActiveDays\", .upToNextMinor(from: \"1.0.0\"))\n        ],\n        targets: [\n            .target(name: \"YourTargetName\", dependencies: [\"ActiveDays\"], path: \"./Path/To/Your/Sources\")\n        ]\n    )\n```\n\nEnjoy!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzonble%2Factivedays","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzonble%2Factivedays","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzonble%2Factivedays/lists"}