Post

Replies

Boosts

Views

Activity

WeatherKit - one "request" or two?
I have a Swift app that fetches current conditions and daily forecasts. It is in production and working without issues. My question is whether the fetch I am using counts as a single “request” for usage thresholds, or two (one for current conditions, one for daily forecast)? I need current conditions more often than daily forecast, so if this is counting as two requests, I could refactor the logic to get each separately as needed. But separating the requests would use more quota if the combined fetch counts as a single request. let service = WeatherService() let location = CLLocation(latitude: weatherData.lat, longitude: weatherData.lon) let startOfToday = Calendar.current.startOfDay(for: Date()) let endDate = Calendar.current.date(byAdding: DateComponents(day: 2), to: startOfToday)! let current: CurrentWeather let daily: Forecast<DayWeather> (current, daily) = try await service.weather(for: location, including: .current, .daily(startDate: startOfToday, endDate: endDate))
1
0
581
Apr ’24
For Mac Catalyst, is there an approved method of setting the window's aspect ratio?
I'm currently using this hack to get a reference to the underlying NSWindow: func nsWindow(from window: UIWindow) - AnyObject? {     guard let nsWindows = NSClassFromString("NSApplication")?.value(forKeyPath: "sharedApplication.windows") as? [AnyObject] else { return nil }     for nsWindow in nsWindows {         let uiWindows = nsWindow.value(forKeyPath: "uiWindows") as? [UIWindow] ?? []         if uiWindows.contains(window) { return nsWindow }     }     return nil } Then this to set the aspect ratio:  nsw.setValue(CGSize(width: 1.5, height: 1.0), forKey: "aspectRatio") Which gives the following log output: WARNING: SPI usage of '-[UINSWindow uiWindows]' is being shimmed. This will break in the future. Please file a radar requesting API for what you are trying to do. Before filing a feedback request, is there a more robust/approved method of doing this?
1
1
1.2k
Apr ’21
iOS 13 [TraitCollection] log messages
I get the following 3 new Xcode log messages with iOS 13 on launch (during application didFinishLaunchingWithOptions). Running on iPhone (not simulator). I assume this is just beta noise?[TraitCollection] Class _UISheetPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.[TraitCollection] Class _UIRootPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.[TraitCollection] Class UIPopoverPresentationController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
6
0
5.5k
Jun ’19