Posts

Post not yet marked as solved
6 Replies
1.3k Views
Hello. I took a closer look at the data I'm getting back for hourly forecasts and I'm baffled by results I'm seeing. For example, it's Dec 19, 2022 8:00am PT and I'm asking for the weather for Orchard Park NY (lat 42.766437 long -78.743855) for Dec 23, 2022. The daily forecast tells me they're expected to have 5.9" of snow. However, the hourly forecast with the most snow that day is reported as 0.071" (1.8mm). The Apple Weather app on iOS shows that hour as having 0.6". I wrote a 'for' loop to print the results of my call to WeatherService.shared.weather.         print(oneHour.precipitationAmount.formatted())         print(oneHour.precipitationAmount.description)         print(oneHour.precipitationAmount.unit)         print(oneHour.precipitationAmount.value) 0.071 in 1.8 mm <_NSStatic_NSUnitLength: 0x2010b0178> mm 1.8
Posted Last updated
.
Post not yet marked as solved
1 Replies
576 Views
Hello. I noticed pretty early on that WeatherService.shared.weather seems to cache results. I realized this when I called it, killed network connectivity to my device, and then called it again I still got results back. My concern is about my widgets, which are also able to call WeatherService.shared.weather. I put my call inside of getTimeline(). After adding logging I realized that getTimeline() is called multiple times at the same time. For example, if I have two different widgets each with three different sizes (small, large, rectangular, etc) then six calls to getTimeline() are made for an update. I found a blog by Shopify iOS developers that describes how they found the same thing, but the forums aren't letting me link to their website's blog. My questions is which of these scenarios is happening: Even though WeatherService.shared.weather is called six times in the same second it's actually only the first call that goes out via the network and the remaining five calls just returned cached results. More than one of the six calls in the same second could be making a network call. If that's the case I'm going to need to add some form of throttling/caching because the number of free API calls per month is limited. Thank you!
Posted Last updated
.
Post not yet marked as solved
1 Replies
524 Views
My SwiftUI weather app shows weather stats for the day that I'm pulling from DayWeather. I added wind speed to my app recently. I wanted to add Gusts but I hit a problem. Whenever I look at the results returned for DayWeather the "gust" inside of Wind is always nil. The iOS weather app includes gusts in a daily summary. For example, today for ****** River, OR it says "Wind is currently 15 mph from the southeast. Today, wind speeds are 8 to 26 mph, with gusts up to 50 mph." A query I just did to WeatherKit returned 18mph with compass direction SSE but nil for gusts. I've searched the documentation and I can't determine if this is working as designed or a bug.
Posted Last updated
.
Post not yet marked as solved
3 Replies
1.6k Views
Version 14.0 beta 4 (14A5284g) This is all referring to the simulator. When I run the Shortcuts app my phrase is properly shown for my app and the app's name is correctly populated. However, when I try to add a SiriTipView the same phrase shows the application name as ${APPLICATIONNAME}. I changed the first letter of the phrase and verified the change showed up in the Shortcuts app and my app tip. I'm not sure if I'm doing something wrong or should file feedback instead.
Posted Last updated
.
Post not yet marked as solved
1 Replies
1.1k Views
I'm using UICalendarView in my SwiftUI app. Inside of my func calendarView() I'm specifying emojis for decorations for certain days and they're showing up just fine. The problem is that VoiceOver completely ignores the decorations. If I touch a day it says the date and "button", which is exactly what I want. I've tried adding all of the accessibility items below but none of them cause VoiceOver to mention the day's decoration.        return .customView {         let emoji = UILabel()         emoji.text = foundEvent.emoji         emoji.isAccessibilityElement = true         emoji.accessibilityIdentifier = "identifier"         emoji.accessibilityTraits = .staticText         emoji.accessibilityLabel = "I like turtles."         emoji.accessibilityValue = foundEvent.emoji         emoji.accessibilityHint = "I also like turtles."         return emoji       }
Posted Last updated
.
Post not yet marked as solved
1 Replies
913 Views
I was seeing some behavior I couldn't understand with onAppear and my tabs (Xcode 12 beta 3). I wrote a quick project with two tabs to test. Here's tab1 (tab2 is the same).    var body: some View {     NavigationView {     Text("Tab1")     }     .onAppear() {       let datefor = DateFormatter()       datefor.timeStyle = .medium       print("onAppear tab1 \(datefor.string(from: Date()))")     }     .onDisappear() {       print("onDisappear tab1")     }   } At app launch: onAppear tab1 10:29:18 AM onAppear tab2 10:29:18 AM Touch tab2: onDisappear tab1 onDisappear tab2 onAppear tab2 10:29:42 AM onAppear tab1 10:29:42 AM Now this is where it gets interesting. Touch tab1 and the wrong onAppear gets called: onDisappear tab2 onAppear tab2 10:30:10 AM Touch tab2 and the same thing happens: onDisappear tab1 onAppear tab1 10:30:46 AM
Posted Last updated
.
Post not yet marked as solved
1 Replies
851 Views
I'm seeing unexpected behavior with the SwiftUI Toolbar. This code works but the items are grouped together in the center of the toolbar (as expected). However, if I add the two Spacers everything disappears.              ToolbarItem(placement: .bottomBar) {               HStack {                 Button(Constants.Buttons.Location) {                   print("button")                 }                 //Spacer()                 Image(systemName: Constants.Icons.Share)                 //Spacer()                 Button(Constants.Buttons.Website) {                   print("button")                 }               }             } If I add them all individually (including the two Spacers) I get the result I was expecting.        ToolbarItem(placement: .bottomBar) {         Button(Constants.Buttons.Location) {           print("button")         }       }       ToolbarItem(placement: .bottomBar) {         Spacer()       }       ToolbarItem(placement: .bottomBar) {         Image(systemName: Constants.Icons.Share)       }       ToolbarItem(placement: .bottomBar) {         Spacer()       }       ToolbarItem(placement: .bottomBar) {         Button(Constants.Buttons.Website) {           print("button")         }       }
Posted Last updated
.