{"id":2207,"url":"https://github.com/yonat/BatteryView","last_synced_at":"2025-08-06T14:32:54.458Z","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":52,"open_issues_count":1,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-01T14:47:29.935Z","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},"funding":{"github":["yonat"]}},"created_at":"2016-11-28T14:55:39.000Z","updated_at":"2024-11-06T08:21:05.000Z","dependencies_parsed_at":"2023-12-15T21:35:03.259Z","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":18,"template":false,"template_full_name":null,"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","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228915455,"owners_count":17991409,"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":["battery","swift"],"created_at":"2024-01-05T20:16:07.604Z","updated_at":"2024-12-09T15:30:49.730Z","avatar_url":"https://github.com/yonat.png","language":"Swift","funding_links":["https://github.com/sponsors/yonat"],"categories":["UI","Libs","UI [🔝](#readme)"],"sub_categories":["Font","UI","Other free courses","Other Testing"],"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"}