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
Post
Replies
Boosts
Views
Activity
I was notified last week that background access to HomeKit characteristics was not being considered, due to privacy considerations, so I think they misunderstood your request
This one is still an issue in Beta 3
Got a response on my feedback - sadly, it’s not a feature that’s likely to come to HomeKit. The reason is to prevent third party apps from being able use this data to profile a users activity in their home. I do understand this, but hope that there’s eventually a way to do this, even if it means other restrictions are applied
@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.
I'm seeing this a lot more in Xcode 12 beta 2 as well
I've spent some time on this again, reworking as Apple_Kevin suggests, but the issue still occurs for me. Exists in Beta 2 as well
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.
I have filed a feedback for this feature (FB7805464) -- if any developers are interested in this as well, please do the same!
Agreed -- application logs have become very sloppy, and difficult to decipher
If this can be done in a battery sensitive way (I’m sure it can), I would welcome this as well.
It is not possible today, unfortunately, but I agree that it should be. I filed a feedback for this yesterday (FB7775451) - please do the same, if this feature is important to you, as this can influence things
I've filed a Feedback on this (FB7783961) -- to any developers who come across this, and would like this feature, please do the same!
@HeGer - Thanks for sharing the entry. I've created a Feedback to request this (FB7783891) - to any developer who comes across this, please do the same!
That watchOS/tvOS example is exactly what I think is necessary across the board. I've filed a feedback on this (FB7783891) -- to any other developers who came across this, please file your own Feedback, as this can influence feature sets, especially in volume!