Post

Replies

Boosts

Views

Activity

Reply to didSet not called
Property observers might not work the way you think they should when you have property wrappers. If you have a published property defined as: @Published var myProperty: String The type of that property is not String, it's Published<Self.Output>.Publisher (or something like that) - when you do something like myProperty = "A new value", the property wrapper is effectively intercepting the variable assignment, and updating its' internal representation. In other words, the value of _myProperty.projectedValue changes, but the value of myProperty does not - hence, your didSet observer is never called. I'd call this expected behavior, but perhaps surprising if you're not familiar with how property wrappers work. You can, of course, subscribe to the publisher (which will give you willSet semantics), or you may be able to create an extension of Published to give you what you want
Aug ’20
Reply to HomeKit and Siri Shortcuts integration
@LVS8Barrs Developer, I'm seeing now that my original question may have been confusing -- what I'm looking for is not to have the ability to trigger a HomeKit Scene via a Shortcut automation, but (kind of) the other way around. I want to have a HomeKit trigger (such as motion detected) be able to trigger the Siri Intent of a 3rd party app. The 'Intruder' scene that I mention above (flashing a light) can be achieved in the Shortcuts app, but this requires the user to program it themselves, which is obviously not the majority of users. I have an app in the AppStore that can be manipulate the HomeKit lights in the home for communication purposes (flash the kids lights with "Hey Siri, Dinner Time", etc), and my #1 most requested feature is to trigger the shortcut on motion detection and button presses, but today (and in iOS 14, currently), it can't be done. The other aspect with my app is for accessibility purposes. Light manipulation can be used by those with a hearing disability, and a large percentage of this audience is older - I would like to allow this integration to be made as simply as possible, but today, it's not possible. My father is in this audience, and doesn't even know what the Shortcuts app is, much less have the patience to figure out how to flash a light with it.
Jul ’20
Reply to NavigationLink Clears my 'selection'
The only functional difference I can see in the code above is to ensure that the enclosing NavigationView (which was not in my example, but is a layer up) has a second View inside it, representing the 'Default' view that is shown, prior to taping one of the NavigationLink. It didn't work. The observed behavior is still that each time I tap one of the NavigationLinks in the sidebar the sidebar is refreshed twice -- once with the selectedHomeId populated properly, and again with the selectedHomeId set to nil. Visually, everything looks fine -- the second refresh of the side bar does not clear out the detail view.
Jul ’20