{"id":26281053,"url":"https://github.com/yonat/batteryview","last_synced_at":"2025-07-30T22:10:57.805Z","repository":{"id":56903548,"uuid":"74983420","full_name":"yonat/BatteryView","owner":"yonat","description":"Simple battery shaped UIView","archived":false,"fork":false,"pushed_at":"2024-11-01T13:55:53.000Z","size":74,"stargazers_count":51,"open_issues_count":1,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-04T19:05:36.378Z","etag":null,"topics":["battery","swift"],"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/yonat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","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},"funding":{"github":["yonat"]}},"created_at":"2016-11-28T14:55:39.000Z","updated_at":"2025-05-25T11:55:22.000Z","dependencies_parsed_at":"2024-12-09T15:42:27.305Z","dependency_job_id":null,"html_url":"https://github.com/yonat/BatteryView","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":"0.020408163265306145","last_synced_commit":"95cf9cb367fda6e2b6938b3ead6ea5bf1b9e3399"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/yonat/BatteryView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonat%2FBatteryView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonat%2FBatteryView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonat%2FBatteryView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonat%2FBatteryView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yonat","download_url":"https://codeload.github.com/yonat/BatteryView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yonat%2FBatteryView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267950642,"owners_count":24170876,"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-07-30T02:00:09.044Z","response_time":70,"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":["battery","swift"],"created_at":"2025-03-14T15:18:58.673Z","updated_at":"2025-07-30T22:10:57.749Z","avatar_url":"https://github.com/yonat.png","language":"Swift","funding_links":["https://github.com/sponsors/yonat"],"categories":[],"sub_categories":[],"readme":"# BatteryView\nSimple battery shaped UIView.\n\n[![Swift Version][swift-image]][swift-url]\n[![Build Status][travis-image]][travis-url]\n[![License][license-image]][license-url]\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/BatteryView.svg)](https://img.shields.io/cocoapods/v/BatteryView.svg)  \n[![Platform](https://img.shields.io/cocoapods/p/BatteryView.svg?style=flat)](http://cocoapods.org/pods/BatteryView)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"Screenshots/Battery.png\"\u003e\n\u003c/p\u003e\n\n## Usage\n\n```swift\nlet batteryView = BatteryView(frame: smallRect)\nbatteryView.level = 42 // anywhere in 0...100\nbatteryView.lowThreshold = 25 // battery fill becomes red if level is below this threshold\nbatteryView.gradientThreshold = 50 // battery fill gradually changes from green to red below this threshold\n```\n\n## SwiftUI Usage\n\n```swift\nBatteryShape(level: $level)\n```\n\n## Changing Appearance\n\nThe properties below can be set in Interface Builder, in code, or through a UIAppearance proxy (e.g., `BatteryView.appearance().borderColor = .gray`).\nWhen using SwiftUI you can set them in the `BatteryShape` initializer .\n\n**Colors:**\n\n```swift\nbatteryView.borderColor    = .darkGray\nbatteryView.highLevelColor = .green\nbatteryView.lowLevelColor  = .red\nbatteryView.noLevelColor   = .gray\nbatteryView.noLevelText = \"?\" // shown over battery when the level is undefined or out of bounds\n```\n\n**Battery Shape:**\n\n```swift\nbatteryView.direction = .minXEdge     // terminal facing left\n\nbatteryView.terminalLengthRatio = 0.1 // relative to battery length\nbatteryView.terminalWidthRatio = 0.4  // relative to battery width\n\nbatteryView.borderWidth = 2.5         // default is batteryLength / 20\nbatteryView.cornerRadius = 5          // default is batteryLength / 10\n```\n\n## Installation\n\n### CocoaPods:\n\n```ruby\npod 'BatteryView'\n```\n\n### Swift Package Manager:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/yonat/BatteryView\", from: \"1.4.4\")\n]\n```\n\n## Meta\n\n[@yonatsharon](https://twitter.com/yonatsharon)\n\n[https://github.com/yonat/BatteryView](https://github.com/yonat/BatteryView)\n\n[swift-image]:https://img.shields.io/badge/swift-4.2-orange.svg\n[swift-url]: https://swift.org/\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg\n[license-url]: LICENSE.txt\n[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonat%2Fbatteryview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyonat%2Fbatteryview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyonat%2Fbatteryview/lists"}