Post

Replies

Boosts

Views

Activity

SF Symbol using string interpolation
I was very happy when I saw this: "You can embed a symbol inside a run of text by using string interpolation." Text("Thalia… \(Image(systemName: "chevron.forward"))") Unfortunately this is a feature of SwiftUI and not generally available string interpolation. In places where a string is expected like an Apple Watch Compilcation Text Provider CLKSimpleTextProvider(text: "\(Image(systemName: "heart"))") this doesn't return an inline Image but "Image(provider: SwiftUI.ImageProviderBox<SwiftUI.Image.(unknown context at $18487da20).NamedImageProvider>)" So… Is there a way to include an SF Symbol in a regular string to wiggle it into a CLKSimpleTextProvider?
2
0
3k
Dec ’21
HKQuery.predicateForSamples - how is endDate: nil interpreted
I'm trying to get all samples after a given startDate and have that query running for as long as the app is "alive" including background. I used let predicate = HKQuery.predicateForSamples(withStart: queryStart, end: nil, options: HKQueryOptions.strictStartDate) I thought: if its not specified it cannot be restricting… From the results I am getting I infer that it's using the end of the day the query is executed as a restriction: I am getting all updates the same day with the samplesUpdatequeryResultshandler but the next morning my app doesn't receive samples unless I restart it. Edit: I should mention I am using options: HKQueryOptions.strictStartDate Is it too much to ask that the documentation mention how nil is handled if it's allowed? One could omit the ? and everyone would know to specify the end date. I'll now use let queryEndDate = Calendar.current.date(byAdding: .year, value: 10, to: Date())! See how that goes.
0
0
1.1k
Aug ’21
Xcode 13 Beta if I only have one single Mac
I only have one Mac and I would like to be able to reliably update my apps before iOS 15 and Xcode 13 become publicly available explore features of iOS15 and Xcode 13 Betas. Can I install Xcode 13 Beta parallel to my current stable Xcode 12? How do I make sure both versions don't interfere with each other? Of can I / should I trust stability of Xcode 13 Beta and just jump right in? Will apps targeted for iOS14 be accepted on the App Store if built by Xcode 13 Beta?
3
0
5.7k
Jun ’21
App Icon missing in Apple Watch Series 7
App Icon is a black hole in Apple Watch Series 7, shows alright in Apple Watch Series 6. Both latest watchOS8. App was downloaded from App Store and the App Icon Page in Xcode looks quite nice. Also: no problem in simulator with Series7/watchOS8 What's going on? PS: the other black hole is a very popular app from the App Store. Not telling which…
2
0
1.1k
Oct ’21
SwiftUI Runtime Error from if condition { Text() } in watchOS
As far as I read about conditional Views this code should work. But it doesn't. struct Consts { static let myCondition = false /* no difference if true or false */ } struct ContentView: View { @State var toggle: Bool = false var body: some View { List() { Text("Short Text is in first line") Text("Second Line Text is a little longer but not much") if Consts.myCondition { Text("This is a conditional text. As in: when the user hasn't purchased the option he / she don't need a hint how to use this feature.") /* } else { Text("else doesn't help either.") */ } Toggle("I also have a toggle but it has nothing to do with this.", isOn: $toggle) Text("Here we have a longer Text. Dont know what to type any more.") Text("More text which is longer than a few lines.") Text("Not so long Text") } .navigationTitle("Hints &amp; Settings") } } It compiles without warnings or errors. It loads up and displays fine, on simulator and on device. But every time I scroll the List upwards from the end, as soon as this if condition { Text() } should become visible the app crashes with Fatal error: file SwiftUI, line 0 2021-03-07 06:36:26.548126+0100 WTFif WatchKit Extension[23163:641812] Fatal error: file SwiftUI, line 0 This is not limited to watchOS. It reproduces the same way in iOS, just the Texts have to be longer so that the if condition { Text() } becomes invisible when scrolling. I have worked around the error with an array, conditional ranges and two ForEach() blocks. struct ContentView: View { let myHints = ["Short Text is in first line", "Second Line Text is a little longer but not much", "This is a conditional text. As in: when the user hasn't purchased the option he / she don't need to hint how to use this feature.", "Here we have a longer Text. Dont know what to type any more.", "More text which is longer than a few lines.", "Not so long Text"] var myUpperRange: ClosedRangeInt { if Consts.myCondition { return 0...1 } else { return 0...2 } } var myLowerRange: ClosedRangeInt { return 3...5 } @State var toggle: Bool = false var body: some View { List() { ForEach (myUpperRange, id: \.self) { i in Text(myHints[i]) } Toggle("I also have a toggle but it has nothing to do with this.", isOn: $toggle) ForEach (myLowerRange, id: \.self) { i in Text(myHints[i]) } } .navigationTitle("Hints &amp; Settings") } } My question basically is: am I not getting it or did I find a bug in Xcode / SwiftUI? Should my code above work? What could I have done different to make it work with the simple list of Texts? Background: I also have a TabView with an if condition { MyTab() } which works without crashing. Do I have to worry that this might crash in the same way? Should I work around this as well before shipping? PS: I am using Xcode 12.4 (12D4e)
4
0
2.2k
Jul ’21
How do I modify a SwiftUI Gauge so that it fills the parent View completely?
Hello, I want to use the Gauge View with circular style not only in my app's complications but also in the watchOS app. When I put the Gauge in my View it just sits right in the middle and I cannot figure out how to scale it up. .resizable() is not available. .scaledToFill() and .scaledToFit()don't do anything .scaleEffect(3) makes the Labels blurry Gauge(value: 0.5, in: 0...1,       label: { Text("Gauge") },       currentValueLabel: { Text("0.5") },       minimumValueLabel: { Text("0") },       maximumValueLabel: { Text("1") } ).gaugeStyle(CircularGaugeStyle()) What am I missing?
0
0
1.4k
Mar ’21
Neither getCurrentTimelineEntry nor getLocalizableSampleTemplate get called by Complication Controller
I have an iPhone with Watch Project, I was getting good results on my Complications but lately they don't want to update… When I build and run on my iPhone the new Watch build gets transferred to the paired watch and is running there fine. Almost: it refuses to update the Complications. After Watch restart I only get ----- My server correctly tells me that I have two active complications on the current watchFace and I am calling server.reloadTimeline(for:) on both of them but the getCurrentTimelineEntry function never gets executed by the server. Neither does the getLocalizableSampleTemplate When I remove the App from the Watch, restart the Watch and then put the App back on the Watch using the iPhone's Watch App -- then it works, but only about 3 minutes after starting the Watch App on the Watch. During these 3 minutes my app's complications are only --. I can't ship it like this… My hunch is that somewhere the complication controller crashes, but it doesn't take my app down with it and thus my complications don't work any more. All other apps' complications do update alright though. Now my question is: is that a bug in Xcode, in WatchOS, or in my code? Will this happen when I first deploy my app on the App Store or will it be an issue with updates via App Store? Is this only relevant for my "local" build? Any hints where to hunt this bug?
1
0
1.8k
Oct ’22
watchOS Simulator Version 14.0.1 (986.3) not syncing HealthKit from iPhone to paired Apple Watch
I have a project that's been on the App Store for more than a year. I used to do ASC screenshots and debugging on Simulator with a few Watch Simulators (screen sizes) paired to one iPhone simulator sharing the same HealthKit example data and settings like units and regions / languages. Since updating to Xcode 14 I can't get the HealthKit related data and settings to sync between and iPhone Simulator and it's paired watch Simulators. Any idea what I am doing wrong now? I should note that my project is still using iOS App, WatchKit App and WatchKit Extension. I haven't yet switched to single-target WatchApp.
1
0
1.1k
Oct ’22
SF Symbol using string interpolation
I was very happy when I saw this: "You can embed a symbol inside a run of text by using string interpolation." Text("Thalia… \(Image(systemName: "chevron.forward"))") Unfortunately this is a feature of SwiftUI and not generally available string interpolation. In places where a string is expected like an Apple Watch Compilcation Text Provider CLKSimpleTextProvider(text: "\(Image(systemName: "heart"))") this doesn't return an inline Image but "Image(provider: SwiftUI.ImageProviderBox<SwiftUI.Image.(unknown context at $18487da20).NamedImageProvider>)" So… Is there a way to include an SF Symbol in a regular string to wiggle it into a CLKSimpleTextProvider?
Replies
2
Boosts
0
Views
3k
Activity
Dec ’21
HKQuery.predicateForSamples - how is endDate: nil interpreted
I'm trying to get all samples after a given startDate and have that query running for as long as the app is "alive" including background. I used let predicate = HKQuery.predicateForSamples(withStart: queryStart, end: nil, options: HKQueryOptions.strictStartDate) I thought: if its not specified it cannot be restricting… From the results I am getting I infer that it's using the end of the day the query is executed as a restriction: I am getting all updates the same day with the samplesUpdatequeryResultshandler but the next morning my app doesn't receive samples unless I restart it. Edit: I should mention I am using options: HKQueryOptions.strictStartDate Is it too much to ask that the documentation mention how nil is handled if it's allowed? One could omit the ? and everyone would know to specify the end date. I'll now use let queryEndDate = Calendar.current.date(byAdding: .year, value: 10, to: Date())! See how that goes.
Replies
0
Boosts
0
Views
1.1k
Activity
Aug ’21
Xcode 13 Beta if I only have one single Mac
I only have one Mac and I would like to be able to reliably update my apps before iOS 15 and Xcode 13 become publicly available explore features of iOS15 and Xcode 13 Betas. Can I install Xcode 13 Beta parallel to my current stable Xcode 12? How do I make sure both versions don't interfere with each other? Of can I / should I trust stability of Xcode 13 Beta and just jump right in? Will apps targeted for iOS14 be accepted on the App Store if built by Xcode 13 Beta?
Replies
3
Boosts
0
Views
5.7k
Activity
Jun ’21
How do I check my app's "background app refresh budget"?
Is there a way to find out how much of the app's budget is used up already?
Replies
1
Boosts
0
Views
1.4k
Activity
Oct ’22
App Icon missing in Apple Watch Series 7
App Icon is a black hole in Apple Watch Series 7, shows alright in Apple Watch Series 6. Both latest watchOS8. App was downloaded from App Store and the App Icon Page in Xcode looks quite nice. Also: no problem in simulator with Series7/watchOS8 What's going on? PS: the other black hole is a very popular app from the App Store. Not telling which…
Replies
2
Boosts
0
Views
1.1k
Activity
Oct ’21
SwiftUI Runtime Error from if condition { Text() } in watchOS
As far as I read about conditional Views this code should work. But it doesn't. struct Consts { static let myCondition = false /* no difference if true or false */ } struct ContentView: View { @State var toggle: Bool = false var body: some View { List() { Text("Short Text is in first line") Text("Second Line Text is a little longer but not much") if Consts.myCondition { Text("This is a conditional text. As in: when the user hasn't purchased the option he / she don't need a hint how to use this feature.") /* } else { Text("else doesn't help either.") */ } Toggle("I also have a toggle but it has nothing to do with this.", isOn: $toggle) Text("Here we have a longer Text. Dont know what to type any more.") Text("More text which is longer than a few lines.") Text("Not so long Text") } .navigationTitle("Hints &amp; Settings") } } It compiles without warnings or errors. It loads up and displays fine, on simulator and on device. But every time I scroll the List upwards from the end, as soon as this if condition { Text() } should become visible the app crashes with Fatal error: file SwiftUI, line 0 2021-03-07 06:36:26.548126+0100 WTFif WatchKit Extension[23163:641812] Fatal error: file SwiftUI, line 0 This is not limited to watchOS. It reproduces the same way in iOS, just the Texts have to be longer so that the if condition { Text() } becomes invisible when scrolling. I have worked around the error with an array, conditional ranges and two ForEach() blocks. struct ContentView: View { let myHints = ["Short Text is in first line", "Second Line Text is a little longer but not much", "This is a conditional text. As in: when the user hasn't purchased the option he / she don't need to hint how to use this feature.", "Here we have a longer Text. Dont know what to type any more.", "More text which is longer than a few lines.", "Not so long Text"] var myUpperRange: ClosedRangeInt { if Consts.myCondition { return 0...1 } else { return 0...2 } } var myLowerRange: ClosedRangeInt { return 3...5 } @State var toggle: Bool = false var body: some View { List() { ForEach (myUpperRange, id: \.self) { i in Text(myHints[i]) } Toggle("I also have a toggle but it has nothing to do with this.", isOn: $toggle) ForEach (myLowerRange, id: \.self) { i in Text(myHints[i]) } } .navigationTitle("Hints &amp; Settings") } } My question basically is: am I not getting it or did I find a bug in Xcode / SwiftUI? Should my code above work? What could I have done different to make it work with the simple list of Texts? Background: I also have a TabView with an if condition { MyTab() } which works without crashing. Do I have to worry that this might crash in the same way? Should I work around this as well before shipping? PS: I am using Xcode 12.4 (12D4e)
Replies
4
Boosts
0
Views
2.2k
Activity
Jul ’21
How do I modify a SwiftUI Gauge so that it fills the parent View completely?
Hello, I want to use the Gauge View with circular style not only in my app's complications but also in the watchOS app. When I put the Gauge in my View it just sits right in the middle and I cannot figure out how to scale it up. .resizable() is not available. .scaledToFill() and .scaledToFit()don't do anything .scaleEffect(3) makes the Labels blurry Gauge(value: 0.5, in: 0...1,       label: { Text("Gauge") },       currentValueLabel: { Text("0.5") },       minimumValueLabel: { Text("0") },       maximumValueLabel: { Text("1") } ).gaugeStyle(CircularGaugeStyle()) What am I missing?
Replies
0
Boosts
0
Views
1.4k
Activity
Mar ’21
Release Notes for SF Symbols 3 Beta
Anyone have a link to the release notes, please? https://developer.apple.com/sf-symbols/release-notes/ doesn't include version 3 yet. I'd like to know what might change before it comes out of beta.
Replies
0
Boosts
0
Views
975
Activity
Jun ’21
Neither getCurrentTimelineEntry nor getLocalizableSampleTemplate get called by Complication Controller
I have an iPhone with Watch Project, I was getting good results on my Complications but lately they don't want to update… When I build and run on my iPhone the new Watch build gets transferred to the paired watch and is running there fine. Almost: it refuses to update the Complications. After Watch restart I only get ----- My server correctly tells me that I have two active complications on the current watchFace and I am calling server.reloadTimeline(for:) on both of them but the getCurrentTimelineEntry function never gets executed by the server. Neither does the getLocalizableSampleTemplate When I remove the App from the Watch, restart the Watch and then put the App back on the Watch using the iPhone's Watch App -- then it works, but only about 3 minutes after starting the Watch App on the Watch. During these 3 minutes my app's complications are only --. I can't ship it like this… My hunch is that somewhere the complication controller crashes, but it doesn't take my app down with it and thus my complications don't work any more. All other apps' complications do update alright though. Now my question is: is that a bug in Xcode, in WatchOS, or in my code? Will this happen when I first deploy my app on the App Store or will it be an issue with updates via App Store? Is this only relevant for my "local" build? Any hints where to hunt this bug?
Replies
1
Boosts
0
Views
1.8k
Activity
Oct ’22
watchOS Simulator Version 14.0.1 (986.3) not syncing HealthKit from iPhone to paired Apple Watch
I have a project that's been on the App Store for more than a year. I used to do ASC screenshots and debugging on Simulator with a few Watch Simulators (screen sizes) paired to one iPhone simulator sharing the same HealthKit example data and settings like units and regions / languages. Since updating to Xcode 14 I can't get the HealthKit related data and settings to sync between and iPhone Simulator and it's paired watch Simulators. Any idea what I am doing wrong now? I should note that my project is still using iOS App, WatchKit App and WatchKit Extension. I haven't yet switched to single-target WatchApp.
Replies
1
Boosts
0
Views
1.1k
Activity
Oct ’22