Post

Replies

Boosts

Views

Activity

Reply to Is WeatherKit wind direction backwards?
I think the wind API should be interpreted as documented, and you’re just seeing bad data as mentioned in your other post. In simple testing here, I get perfect agreement between the iOS 16 Weather app and WeatherKit for various test locations (including Penticton, BC), but disagreement between those and the iOS 15 Weather app. In particular the wind direction there is roughly backwards between the two.
Topic: App & System Services SubTopic: General Tags:
Jun ’22
Reply to Is WeatherKit wind direction backwards?
Actually according to the documentation both direction and compassDirection should refer to the direction the wind is coming from. Respectively, Direction the wind is coming from in degrees, with true north at 0 and progressing clockwise from north. ...and: General indicator of wind direction, often referred to as “due north”, “due south”, etc. Refers to the direction the wind is coming from, for instance, a north wind blows from north to south. In the example Wind object: WeatherKit.Wind(compassDirection: East, direction: 90.0 °, speed: 7.09 km/h, gust: Optional(18.18 km/h)) It’s indicating “wind out of the east” (as a simplified weather report may phrase it), specifically from compass direction 90º, which is due east. A wind blowing from due west would be blowing from a direction of 270º.
Topic: App & System Services SubTopic: General Tags:
Jun ’22
Reply to Expected to decode Array<Any> but found a dictionary instead
It’s true, all of it. In this line you are telling the decoder to expect an array of MemberModel objects: let informations = try JSONDecoder().decode([MemberModel].self, from: data) But the JSON you showed is a single JSON object, not an array of them. If you want to decode a single object, then specify the type to decode as MemberModel.self rather than [MemberModel].self.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jun ’22
Reply to keep TextKit 1 in Labels as default in iOS 16
My takeaway from those videos is this: UITextView needs a TextKit 1 compatibility mode because its existing API lets you access the underlying TextKit 1 objects, most notably the layoutManager property. If they removed support for that, then existing code would break. In contrast, UITextField and UILabel never had API for accessing the underlying TextKit 1 objects. So updating the implementation to use only TextKit 2 can’t break existing code. For your pixel-perfect problem, at least TextKit 1 isn’t going away, so you could build your own drop-in UILabel replacement, using either UITextView in TextKit 1 mode or a plain UIView with a whole TextKit 1 stack implemented inside. Not exactly trivial but you would be back in full control.
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’22
Reply to keep TextKit 1 in Labels as default in iOS 16
I’m sure you realize this, but looking for a technical fix for this is almost certainly not going to be fruitful. It’s a new major OS release and Apple decided to improve their text layout logic, and of course they are perfectly free to do that since there’s never been any guarantee of pixel-perfect consistency across releases. I’d be floored if they really decided to add a Text Kit 1 compatibility mode in order to address what you must admit is an edge case not relevant to the overwhelming majority of apps. The real issue, of course, is that someone in your organization unfortunately committed you to a requirement that’s technically infeasible. Aside from finding someone on the other side of the negotiating table who understands and accepts this (that your app isn’t a game and doesn’t draw all the pixels), don’t expect an easy solution. (But I’d love to be wrong. Maybe someone with an  in their username will chime in and disclose an undocumented API that does exactly what you need. 😉)
Topic: UI Frameworks SubTopic: UIKit Tags:
Jun ’22
Reply to JSON Array
Nope, that’s not valid JSON. The top level is an object (starts with curly brace) so it needs to contain keys and values. But you can have an array as the top level in the JSON document, like this: [ {"id": 1, "name": "Otto Matic", "icon": "", "developer": "Pangea Software"}, {"id": 2, "name": "Minecraft", "icon": "", "developer": "Mojang"} ]
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’22
Reply to Filtering an Array
it says the title is a string that is not optional But the compiler disagrees, as the error message basically says the title property is an Optional<String>. Can you show the definition of the Recipe type?
Topic: Programming Languages SubTopic: Swift Tags:
Jun ’22
Reply to Try to Connect Bluetooth Device
Are we able to connect this Bluetooth Device using Core Bluetooth? According to the screenshots it’s a BLE device and advertises that it’s connectible, so yes Core Bluetooth should be able to connect. The bigger issue is that once connected, do you know how to use those services (0xFFE0 and 0xFFF0), if not your own design?
Jun ’22