Post

Replies

Boosts

Views

Activity

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
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 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 CloudKit watchOS 6 silent notification problem
I'm having the same problem on watchOS 8.4.. silent notifications are not being sent to the watch but works perfectly for iOS. let zoneID = CKRecordZone.ID(zoneName: "Settings", ownerName: CKCurrentUserDefaultName) let subscriptionID = "settings-subscription-id let subscription = CKRecordZoneSubscription(zoneID: zoneID, subscriptionID: subscriptionID) let notificationInfo = CKSubscription.NotificationInfo() notificationInfo.shouldSendContentAvailable = true subscription.notificationInfo  let subscription = try await database.save(subscription) I call WKExtension.shared().registerForRemoteNotifications() in applicationDidBecomeActive and didRegisterForRemoteNotifications(deviceToken:) does fire. However, didReceiveRemoteNotification does not fire. I also tried some suggestions here like updating the provisioning profile at AppConnect for watch app and extension which makes sense. Looking at the iCloud console though, the watch is never able to create subscriptions at iCloud at all! I query "Data > Subscriptions" section in console and only see the iOS subscription created. Does each device need to have their own unique subscription? Because I also tried this by putting the vendor device identifier in the subscription ID so each device creates their own, but the watch still never creates a subscription at the server nor does it error on database.save(subscription). Is there a trick for the watch to create subscriptions at iCloud? I'm using the above code but no errors result from it, but the subscription records never shows up on the iCloud console (but iOS does and receives silent fine). I also have "Supports Running without iOS app" checked if that makes a difference.
Jan ’22
Reply to swift-frontend memory usage
Seems like SwiftUI is tripping up Xcode 13 a lot. Commenting out a random ScrollView or other view sometimes works. swift-frontend process has gone so high to 145GB at one point and I only have 32GB RAM on this machine (Big Sur 11.6.1 / Xcode 13.1).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to swift-frontend memory usage
Still happening with Xcode 13.1 official release :( The other thread doesn't seem to be related, but wondering if there's something in the Xcode build settings that can be disabled until Apple fixes this debilitating issue?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’21
Reply to Text with relative date - sizing bug when used in widget
Same with official iOS 18 release. See existing thread about known issue: https://forums.developer.apple.com/forums/thread/762658
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to Complications in WidgetKit - .accessoryCorner with curved text
The comment above doesn't work which is for an icon and doesn't address the issue. Any updates from anyone? This is the biggest complaint on my app. Developers and users are frustrated Apple dropping the ball on this :(
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to After iOS 16.1 Widgets + Extensions get the local form device language not from the app
I'm having the same issue, I submitted a ticket but no response yet: FB11737627. Any updates?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’22
Reply to Complications in WidgetKit - .accessoryCorner with curved text
This is still an issue with watchOS 9.1 / Xcode 14.1. It gets truncated no matter what I do, I can't put any reasonable text in there not even a time or count down! It looks silly with so much wasted space around it, not sure why Apple is saying they won't support it.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’22
Reply to AttributeGraph: cycle detected
Same issue, seems like TextField + Focus + Keyboard is causing the attribute graph issue for me.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’22
Reply to Connection error sending Local UserNotification
I've been randomly getting this too in iOS 15.4-6 but can't pin point when. Have you figured anything about this?
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Aug ’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:
Replies
Boosts
Views
Activity
Aug ’22
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:
Replies
Boosts
Views
Activity
Apr ’22
Reply to CLKTimeIntervalGaugeProvider alternative in Swift UI
Unfortunately not at the moment. I'm having to create dummy entries in the timelines series every 15 minutes or so to refresh the progress value which is not ideal. I submitted a feedback: FB9918102
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22
Reply to CloudKit watchOS 6 silent notification problem
I'm having the same problem on watchOS 8.4.. silent notifications are not being sent to the watch but works perfectly for iOS. let zoneID = CKRecordZone.ID(zoneName: "Settings", ownerName: CKCurrentUserDefaultName) let subscriptionID = "settings-subscription-id let subscription = CKRecordZoneSubscription(zoneID: zoneID, subscriptionID: subscriptionID) let notificationInfo = CKSubscription.NotificationInfo() notificationInfo.shouldSendContentAvailable = true subscription.notificationInfo  let subscription = try await database.save(subscription) I call WKExtension.shared().registerForRemoteNotifications() in applicationDidBecomeActive and didRegisterForRemoteNotifications(deviceToken:) does fire. However, didReceiveRemoteNotification does not fire. I also tried some suggestions here like updating the provisioning profile at AppConnect for watch app and extension which makes sense. Looking at the iCloud console though, the watch is never able to create subscriptions at iCloud at all! I query "Data > Subscriptions" section in console and only see the iOS subscription created. Does each device need to have their own unique subscription? Because I also tried this by putting the vendor device identifier in the subscription ID so each device creates their own, but the watch still never creates a subscription at the server nor does it error on database.save(subscription). Is there a trick for the watch to create subscriptions at iCloud? I'm using the above code but no errors result from it, but the subscription records never shows up on the iCloud console (but iOS does and receives silent fine). I also have "Supports Running without iOS app" checked if that makes a difference.
Replies
Boosts
Views
Activity
Jan ’22
Reply to swift-frontend memory usage
This thread is my new hang out spot when I can't get any work done
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to SwiftUI Pull to Refresh Support
Thank you for refreshable in SwiftUI 3! When applied to a ScrollView it does not appear, but works with a List. Is it this something that can be supported in iOS 15?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to swift-frontend memory usage
Seems like SwiftUI is tripping up Xcode 13 a lot. Commenting out a random ScrollView or other view sometimes works. swift-frontend process has gone so high to 145GB at one point and I only have 32GB RAM on this machine (Big Sur 11.6.1 / Xcode 13.1).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21
Reply to swift-frontend memory usage
Still happening with Xcode 13.1 official release :( The other thread doesn't seem to be related, but wondering if there's something in the Xcode build settings that can be disabled until Apple fixes this debilitating issue?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’21