Swiftpack.co - alldritt/LNSBatteryLevel as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by alldritt.
alldritt/LNSBatteryLevel 1.1.3
A SwiftUI battery charge level view
⭐️ 1
🕓 2 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/alldritt/LNSBatteryLevel.git", from: "1.1.3")

LNSBatteryLevel

A SwiftUI battery charge level view.

Example

Installation

Add the LNSBatteryLevel swift package to your project:

https://github.com/alldritt/LNSBatteryLevel.git

Usage

LNSBatteryLevel is a view you can combine with other SwiftUI views to add a battery charge indicator to your application:

import SwiftUI
import LNSBatteryLevel

struct ContentView: View {
    @State var level = CGFloat(0.2)
    @State var charging = false

    var body: some View {
        VStack {
            LNSBatteryLevel(level: $level, charging: $charging, borderColor: .blue)
                .frame(width: 200, height: 200)
                .padding()
            Slider(value: $level)
            Toggle("Charging", isOn: $charging)
        }
        .padding()
    }
}

Example App

An example application is included illustrating some of the ways the LNSBatteryLevel view can be customized.

GitHub

link
Stars: 1
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

2 years ago

Add criticalThreshold and criticalColor.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics