Swiftpack.co - Package - alldritt/LNSBatteryLevel

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

alldritt/LNSBatteryLevel

A SwiftUI battery charge level view

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: 0
Last commit: Yesterday

Releases

macOS compilation - 2021-02-24T23:21:51

Correct a minimum macOS version requirement error.