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

Latest commit

 

History

History
37 lines (31 loc) · 1.07 KB

README.md

File metadata and controls

37 lines (31 loc) · 1.07 KB

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)")
        }
    }
}