{"id":25390530,"url":"https://github.com/vikill33/swiftui-contributionchart","last_synced_at":"2026-03-16T21:34:11.389Z","repository":{"id":65705681,"uuid":"522787752","full_name":"VIkill33/SwiftUI-ContributionChart","owner":"VIkill33","description":"A SwiftUI Contribution Chart (GitHub-like) implementation package ","archived":false,"fork":false,"pushed_at":"2024-07-31T09:02:09.000Z","size":40,"stargazers_count":104,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-08-01T10:24:53.494Z","etag":null,"topics":["graph","ios","macos","swift","swiftui","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VIkill33.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-08-09T03:23:51.000Z","updated_at":"2024-07-31T09:00:35.000Z","dependencies_parsed_at":"2023-12-05T09:54:18.407Z","dependency_job_id":null,"html_url":"https://github.com/VIkill33/SwiftUI-ContributionChart","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIkill33%2FSwiftUI-ContributionChart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIkill33%2FSwiftUI-ContributionChart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIkill33%2FSwiftUI-ContributionChart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIkill33%2FSwiftUI-ContributionChart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VIkill33","download_url":"https://codeload.github.com/VIkill33/SwiftUI-ContributionChart/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239007912,"owners_count":19567006,"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":["graph","ios","macos","swift","swiftui","watchos"],"created_at":"2025-02-15T14:56:01.840Z","updated_at":"2025-10-30T17:30:57.139Z","avatar_url":"https://github.com/VIkill33.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ContributionChart\n\nA contribution chart (aka. heatmap, GitHub-like) library for iOS, macOS, and watchOS.\n\n100% written in SwiftUI.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/78488529/183985880-614250a8-7d9d-4bfe-96b3-08d95d90d6e1.png\" width=\"120\" height=\"150\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/78488529/183985888-6724caf4-4f77-4467-9d0b-4e202159ef89.png\" width=\"120\" height=\"150\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/78488529/183985895-22ae2cd3-15d7-404f-acd8-2ecee6c74ae3.png\" width=\"120\" height=\"150\"\u003e\n\n- [It Supports](#it-supports)\n  * [Custom Block Number](#custom-block-number)\n  * [Custom Block Color](#custom-block-color)\n  * [Dark mode](#dark-mode)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Demo Code](#demo-code)\n\nUpdates\n- 7/31/24 Support input array with any length and add a demo app inside.\n\n# It Supports\n## Custom Block Number\nOf course, you can also custom the **size** of blocks and **spacing** between blocks.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/78488529/183973081-d743c369-8f61-4c72-a211-b51183bf28f2.JPEG\" width=\"255\" height=\"482\"\u003e \u003cimg src=\"https://user-images.githubusercontent.com/78488529/183973087-22c09508-c9d1-4a77-b87c-dfbd4a4ded63.JPEG\" width=\"255\" height=\"482\"\u003e\n\n## Custom Block Color\nHere are examples using **system colors** as below, and you can custom any color you like.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/78488529/183974533-5c3ae4ae-3530-458e-999a-f87a3924b185.JPEG\" width=\"255\" height=\"482\"\u003e \u003cimg src=\"https://user-images.githubusercontent.com/78488529/183974538-4e14da58-bb4e-4c6a-9c2b-61aab28d3aef.JPEG\" width=\"255\" height=\"482\"\u003e \u003cimg src=\"https://user-images.githubusercontent.com/78488529/183974546-04dd557d-5a59-42fc-bbde-4fbb0b9566ab.JPEG\" width=\"255\" height=\"482\"\u003e\n\n## Dark mode\nAdjust to dark mode color automatically.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/78488529/183975854-60e806c4-5aa8-4adf-8e7c-840fe75c598c.JPEG\" width=\"255\" height=\"482\"\u003e\n\n# Installation\nRequire iOS 13, macOS 10.15, watchOS 6 and Xcode 11 or higher.\nIn Xcode go to `File -\u003e Swift Packages -\u003e Add Package Dependency` \nand paste in the repo's url: \n\n`https://github.com/VIkill33/SwiftUI-ContributionChart.git`\n\nOr you can download the code of this repo, then `Add Local...` in Xcode, and open the folder of the repo.\n\n# Usage\n- Import this package after you installed by `import ContributionChart`\n- Use the chart like\n```swift\nContributionChartView(data: yourData,\n                      rows: yourRows,\n                      columns: yourColumns,\n                      targetValue: yourTargetValue,\n                      blockColor: .green)\n```\nyourData is (**a double array**), and the targetValue is recommanded to set to the max value of the array.\n\nThe color of a block will appear as exactly the color as parameter `blockColor` when its value is equal to `targetValue`, and appears light gray when is equal to zero.\n\nThe top-Leading block represents the first value in array, while the bottom-trailing represents the last. And the order follows as below:\n\n\u003cimg src=\"https://user-images.githubusercontent.com/78488529/183982320-7c8b9d00-7bfb-4701-b2a6-b371cb9996c2.JPEG\" width=\"255\" height=\"482\"\u003e\n\n# Demo Code\n```swift\nimport SwiftUI\nimport ContributionChart\n\nstruct ContentView: View {\n    var data: [Double]\n    let rows = 7\n    let columns = 14\n    \n    init() {\n        data = [0.3, 0.4, 0.4, 0.4, 0.1, 0.5, 0.0, 0.1, 0.0, 0.2, 0.2, 0.2, 0.0, 0.2, 0.2, 0.5, 0.4, 0.2, 0.4, 0.5, 0.2, 0.2, 0.4, 0.3, 0.3, 0.2, 0.4, 0.0, 0.0, 0.5, 0.4, 0.3, 0.5, 0.3, 0.0, 0.0, 0.1, 0.0, 0.2, 0.3, 0.0, 0.0, 0.0, 0.5, 0.3, 0.3, 0.0, 0.3, 0.0, 0.5, 0.3, 0.3, 0.4, 0.5, 0.5, 0.3, 0.4, 0.1, 0.4, 0.2, 0.5, 0.1, 0.4, 0.2, 0.5, 0.4, 0.3, 0.5, 0.0, 0.4, 0.3, 0.2, 0.1, 0.5, 0.2, 0.0, 0.2, 0.5, 0.5, 0.3, 0.4, 0.0, 0.3, 0.3, 0.1, 0.2, 0.5, 0.2, 0.1, 0.4, 0.4, 0.0, 0.5, 0.3, 0.3, 0.5, 0.0, 0.2]\n    }\n    \n    var body: some View {\n                ContributionChartView(data: data,\n                                      rows: rows,\n                                      columns: columns,\n                                      targetValue: 0.5,\n                                      blockColor: .green)\n        }\n    }\n\n\nstruct ContentView_Previews: PreviewProvider {\n    static var previews: some View {\n        ContentView()\n    }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikill33%2Fswiftui-contributionchart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvikill33%2Fswiftui-contributionchart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvikill33%2Fswiftui-contributionchart/lists"}