Post

Replies

Boosts

Views

Activity

Reply to CLKRelativeDateTextProvider values get truncated in circular complications
This is still a bug in watchOS 8. I relied offsetShort but still same problem. It displays fine in the simulator as "28M", but on a real device, it insists in trying to display "28 MIN" which gets truncated to "28..." You can run it in a simulator and real device to see the issue: CLKComplicationTemplateGraphicCircularOpenGaugeSimpleText( gaugeProvider: CLKTimeIntervalGaugeProvider( style: .ring, gaugeColors: nil, gaugeColorLocations: nil, start: Date() - 2000, startFillFraction: 1, end: Date() + 2000, endFillFraction: 0 ), bottomTextProvider: CLKSimpleTextProvider(text: "AB"), centerTextProvider: CLKRelativeDateTextProvider( date: Date() + 1200, style: .naturalAbbreviated, units: [.hour, .minute] ) ) Submitted a feedback and sample project with this code: FB9974072
Topic: App & System Services SubTopic: General Tags:
Apr ’22
Reply to Picker Label not showing anymore
Using the Picker in a Form renders the label as @Merlin52 pointed out. The Form really takes over your design though, which is nice but not when you need to customize it. Here's another sample with a screenshot: struct ContentView: View { var fruits = ["Banana","Apple", "Peach", "Watermelon", "Grapes" ] @State private var selectedFruit = 0 var body: some View { Form { // Variation 1 Picker(selection: $selectedFruit, label: Text("Select Favorite Fruit")) { ForEach(0..<fruits.count, id: \.self) { Text(self.fruits[$0]) } } // Variation 2 Picker(selection: $selectedFruit) { ForEach(0..<fruits.count, id: \.self) { Text(self.fruits[$0]) } } label: { HStack { Text("Favorite Fruit") Divider() Text(fruits[selectedFruit]) } } // Variation 3 Menu { ForEach(0..<fruits.count, id: \.self) { Text(self.fruits[$0]) } } label: { HStack { Text("Favorite Fruit") Divider() Text(fruits[selectedFruit]) } } } .pickerStyle(.menu) } } Here's how everything looks like when I nest everything in a VStack instead of a Form: Notice I added a Menu in there, which seems like the behaviour the OP is expecting. Shouldn't the Picker mimic that behaviour when modified with a MenuPickerStyle? This would mean the label parameter could be optional in the Picker initializer (so it can default to displaying the selected row). Repurposing a Menu as a picker is the painful alternative in the meantime.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22
Reply to Picker Label not showing anymore
If you embed the Picker inside of a Menu, it lets you create a custom label. I'm not sure if this was intended by SwiftUI, but it seems to work perfectly as expected. Menu { Picker(selection: $selectedFruit, label: Text("Select Favorite Fruit")) { ForEach(0..<fruits.count, id: \.self) { Text(fruits[$0]) } } } label: { HStack { Text("Favorite Fruit") Divider() Text(fruits[selectedFruit]) } } Source: https://stackoverflow.com/q/70835085
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’22