Swiftpack.co -  AlmightyBeaver/MultiPicker as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
AlmightyBeaver/MultiPicker
SwiftUI Picker for up to three values which conform to LosslessStringConvertible (e.g. String, Int, Double).
.package(url: "https://github.com/AlmightyBeaver/MultiPicker.git", from: "1.0.1")

MultiPicker

SwiftUI Picker for up to three values which conform to LosslessStringConvertible (e.g. String, Int, Double).

Example Code

 struct MultiPickerExample: View {
     var values1: [String] = ["A", "B", "C", "D", "E", "F"]
     var values2: [Int] = Array(0...23)
     var values3: [Int] = Array(0...59)
     @State var selection1: Int = 1
     @State var selection2: Int = 1
     @State var selection3: Int = 0
     @State var hidePicker: Bool = false
     
     var body: some View {
         Group{
             Toggle("Hide Picker", isOn: $hidePicker)
             if !hidePicker{
                 Button(action: {
                     withAnimation{
                         self.selection1 = 0
                         self.selection2 = 5
                         self.selection3 = 30
                     }
                 }) {
                     Text("Set to A 5 30")
                 }
                 MultiPicker(selection1: $selection1,
                             selection2: $selection2,
                             selection3: $selection3,
                             values1: values1,
                             values2: values2,
                             values3: values3,
                             values1Prefix: ">",
                             values3Suffix: "<",
                             middleText1: "-",
                             middleText2: "-")
                 VStack(alignment: .leading){
                     Text("Value 1: \(self.values1[selection1])")
                     Text("Value 2: \(self.values2[selection2])")
                     Text("Value 3: \(self.values3[selection3])")
                 }
             }
         }
     }
 }

Here is an example of use: https://github.com/AlmightyBeaver/HourPicker

GitHub

link
Stars: 4
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

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