Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.
/ HourPicker Public archive

An expandable SwiftUI hour picker for positive and negative hours.

License

Notifications You must be signed in to change notification settings

AlmightyBeaver/HourPicker

Repository files navigation

HourPicker

An expandable SwiftUI hour picker for positive and negative hours.

Example

struct HourPickerExample: View {
    @State var hours = 2.3
    @State var isDecimalTimeFormatUsed: Bool = false

    var body: some View {
        Form{
            Toggle("Decimal Time", isOn: $isDecimalTimeFormatUsed)
            Button(action: {
                if hours == 2.3{
                    hours = -15.8
                }else {
                    hours = 2.3
                }
            }) {
                Text("Change hours externally")
            }.buttonStyle(BorderlessButtonStyle())
            HourPicker(hours: $hours,
                       title: "Title",
                       captionTitle: "Caption text here",
                       maxHours: 30,
                       isSignPickerVisible: true,
                       isDecimalTimeFormatUsed: isDecimalTimeFormatUsed)
            Text("Value: \(hours)")
        }
    }
}

About

An expandable SwiftUI hour picker for positive and negative hours.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages