Posts

Post not yet marked as solved
9 Replies
4k Views
Using the 'Create SwiftData Code...' action in Xcode results in Model that have bi-directional relationships between many of my entities (which is correct - my Core Data model includes this). All of these Relationships are marked as invalid, however, with the following error: Circular reference resolving attached macro 'Relationship' Most ORM's, in my experience, have a way to mark one end of a bidirectional relationship as an 'owner'. Is there something similar available in SwiftData, or is this scenario handled in a different way? Or am I going to need to remove all of my bidirectional relationships?
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
9 Replies
12k Views
I would love to see more integration between HomeKit and Siri Shortcuts - a common request I get for my app, Home Flash for HomeKit, is to flash a light when motion is detected, or a button is pressed, but it's not possible today. I could envision this being implemented in one of two ways: Allow a scene to execute a Siri Intent, so an 'Intruder' scene could turn on my porch light, and trigger a Siri Intent either on my phone or Apple TV to flash my bedroom or office light. This is my preferred way, since as a 3rd party developer, I have the ability to create Scene's for my users. Add more flexibility to HomeKit Automations that are Converted to Shortcuts, so that I could direct my users in how to do this
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
When using the SidebarListStyle in iOS 14.2 beta 2, all color options are broken, and the view is presented entirely in black and white. This includes both accentColor and listItemTint. I made a very small sample project to prove this, and submitted it on https://feedbackassistant.apple.com/feedback/8775388 Simply removing the .listStyle modifier brings color back, but of course, it loses the styling struct ContentView: View {     var body: some View {         NavigationView {             List {                 Label(                     title: { Text("Should be the accent color") },                     icon: { Image(systemName: "gear") }                 )                 Label(                     title: { Text("Should be Red") },                     icon: { Image(systemName: "questionmark") }                 )                 .listItemTint(.red)             }             .listStyle(SidebarListStyle())         }     } }
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
0 Replies
722 Views
Can the behavior of NSPersistentCloudKitContainer be described in App Extensions? I have seen Forum entries that describe its behavior in Widgets - it will save data locally, but will not sync that data until the app is opened. This is a pretty major downsides for any apps that use SiriKit Extensions to allow for quick, simple data entry -- not syncing the data until the app is opened (which could be days later) would be a deal breaker. I hope this can be clearly described, and improved (if my understanding is correct) - I've filed a feedback to document this as well: FB9170155
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
2 Replies
791 Views
Trying to request a HomeKit lab, and there's no 'Topic' listed in the form - when submitting via the Developer app, it prevents me from submitting the request. I was able to do it via the web, but not via the app!
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
0 Replies
1.5k Views
Typically, using @Published on a property, and then subscribing to the publisher that is created will give you willSet semantics - your subscriber will be notified with the new values before the variable has actually been set. I've observed that if my subscriber receives the notification on a different thread, such as RunLoop.main, the result is that I get didSet semantics - my subscriber is notified after the variable has been set. My question is this: how reliable is this? Can I expect this to be the case 100% of the time, or am I setting myself up for a race condition?
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
6 Replies
1.8k Views
I am creating a Sidebar-style view for an iPad app, using the NavigationLink(destination:tag:selection:label) to control the detail view. Visually, everything appears to be working correctly, however a subtle issue exists when tapping an item to change the selection. The contents of my List are being processed twice, which is observed by putting a breakpoint at the first Text component in the code below - the first time through, my selectedHomeId value is populated correctly (and does load the HomeView correctly), however the second time through, the selectedSignalId is nil. This does not impact the HomeView, and the app is still usable, however it does clear out the SceneStorage that I'm attempting to configure, and it results in the HomeView not being able to respond to changes in my model. 		@SceneStorage("selectedHome") 		var selectedHomeId:String? 		var sidebarType = SidebarType.full 		var body: some View { 				List { 						if sidebarType == .full || sidebarType == .homes { 								Text("Homes") 										.font(.headline) 								ForEach(homeStore.homes) { home in 										NavigationLink(destination: HomeView(home: home), tag: home.id.description, selection: $selectedHomeId) { 												Label(home.name, systemImage: "house") 										} 								} 						} 				} 				.listStyle(SidebarListStyle()) 				.navigationTitle(sidebarType == .homes ? "Homes" : "Other") 				.navigationBarItems(trailing: SettingsButtonView()) 		} I've also filed a feedback for this (FB7845359) - if any other developers have experienced this, please file your own as well!
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
0 Replies
572 Views
Note - I have filed a Feedback for the following feature request, but I believe these features could be useful to other apps as well: FB8077889 I am the developer of Home Flash for HomeKit, designed to take advantage of the HomeKit lights in our homes for communication purposes - my app works great for calling the kids to dinner, but I'm currently exploring the accessibility uses, and finding the API support lacking in a few places. Consider the following: My example user is my father - in his 70's, and having difficulty hearing. He has had hearing aids for years, but the only place I have ever seen them are charging on the counter - I have never seen him use them. Additionally, he does not have his iPhone or iPad on him at all times (I know, I don't understand it either :) ) I would like to be able to use some strategically placed smart bulbs in his office and in the living room to be able to help communicate with him. I can do this today verbally using Siri, so my mother can say "Hey Siri, Get Dad", and have the lights pulse or flash -- setting this up can be done in the app, and my app can guide the user through it. The following two scenarios cannot be setup through the app, and in once can't be setup at all: Scenario 1: Flash a light when a text/email/call is received from a specific person - this would be useful to signal to him that one of his kids and/or friends is trying to communicate with him. NOTE: This CAN be done via the Shortcuts app in iOS 14, but with a huge caveat -- my dad needs to configure it himself, which he will NOT do. I could set this up for him myself, but I am hesitant to do so, because if he ever wants to adjust it or turn it off, he likely would not -- instead, I believe he would get frustrated, and just remove the light bulbs. FEATURE REQUEST #1 - provide an API similar to the HomeKit ActionSet API to be able to programmatically create Shortcut automations. Scenario 2: Trigger Siri Intents from HomeKit triggers. This would be ideal for signaling that someone is at the door, however it is currently not possible. I am aware that it's possible to program a shortcut to flash a light via the Shortcuts app, but my father doesn't even know the Shortcuts app exists, much less is he likely to figure this out. I understand in iOS 14 that the HomePod and Apple TV will be able to announce visitors at the door with an HSV-compliant doorbell, but my dad has neither of these products, nor is he interested in buying them (it would also raise the cost of such a solution significantly). FEATURE REQUEST #2 - allow a HomeKit trigger (Button Press, Accessory is Controlled or Sensor Detects Something) to trigger Siri Intents in 3rd party apps.
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
3 Replies
2.2k Views
I see there are some new focus-related View Modifiers in SwiftUI in iOS 14, but they don't appear to apply to iOS yet. Is there an equivalent for a TextField to use becomeFirstResponder in iOS?
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
4 Replies
863 Views
Most HomeKit objects (HMHome, HMService, HMCharacteristic, etc) have a uniqueIdentifier property that identifies it, however it appears that this value will be different on different devices, and that it can even change over time. I have three questions here: Is it possible to delineate the cases where we should expect it to be different or change Is it possible to make these id's more consistent? If not, can you recommend another means to identify a service or characteristic in a way that's more consistent over time? This causes several complications for 3rd party developers: My app uses Siri Shortcuts to flash a light, and stores the uniqueIdentifier in the Intent, however because this identifier is different on various devices, I can't share this shortcut with my wife, or even on my own iPad I have seen some cases where a shortcut has stopped working -- I believe it's because there are some circumstances where the values actually changes over time.
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
3 Replies
664 Views
There is currently no way to easy way to tell whether an HMActionSet is 'active' without reading the individual characteristics - because each of these reads is an independent, asynchronous process, this check can be delayed, and it is often error prone. Adding a simple state to read and track this information, similar to the value of a characteristic, would simplify a significant burden. A callback notification to be alerted to changes in this state would also be outstanding.
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
2 Replies
952 Views
I have a few app ideas that revolve around helping users to create specific automations, but the API's that are currently available to 3rd party developers provide an awkward way to do this, because we cannot creates Scene's as 'Trigger Owned'. One of my favorite HomeKit apps - Wake Light (not my own app, and I did not consult the developer, but it's a great example of this) - creates a series of automations to turn on my light in the morning, and gradually increase the brightness. It works on any HomeKit compatible bulb, or even dimmer switch, and is great. However after setting up the automation, the Home app shows a series of new Scene's, all listed as 'Favorite' scenes, such as 'WL-01-00', 'WL-01-01', 'WL-01-02', etc. These are the scenes that are associated with new automations, and triggered every few minutes. I have two ways I could see this being resolved: Allow 3rd party developers to use the 'actionSetType' of HMActionSetTypeTriggerOwned - this would prevent the Scene's from being visible in the Home app at all, and (I believe) they would be cleanly removed if the automations are deleted. This would be my preferred way, as it cleanly solves the problem. Allow 3rd party developers to control whether a Scene is considered a 'Favorite' in the Home app, or turn this off as a default value for Scene's created from 3rd party apps.
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
1 Replies
548 Views
In iOS 13 , I am unable to read or write the states of any HomeKit characteristics in a Siri Extension. I am able to create the HMHomeManager, and I receive the normal homeManagerDidUpdateHomes() callback that list all of my accessories normally, but interacting with them at all gives me an HMErrorCode 80, "Missing entitlement for API." This feature used to work in iOS 12, and is a disappointing loss of a feature, if it's by design. I understand the restrictions around why you shouldn't be able to do this while the app is in the background, since users' lights might start to turn on and off for now discernible reason, but this is very different from that. Siri Extensions are generally triggered by an explicit user action, and allowing this type of interaction for a few seconds (it used to be about 10 seconds) allows for some great user features to be added. FB6608447
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
1 Replies
597 Views
I see some sessions about using NSPersistentCloudKitContainer with the public CloudKit database, and it now accepts a ‘databaseScope’ property - can this be used with shared CloudKit databases?
Posted
by Mcorey.
Last updated
.
Post not yet marked as solved
0 Replies
535 Views
In all of the iOS 13 betas so far, I have been unable to read or write the states of any HomeKit devices in a Siri Extension. I am able to create the HMHomeManager, and I receive the normal `homeManagerDidUpdateHomes()` callback that list all of my accessories normally, but interacting with them at all gives me an HMErrorCode 80, "Missing entitlement for API."To be clear, this does work in iOS 12, and I am aware that HomeKit accessories cannot be controlled when the app is in the background. This issue is related to running in a Siri Extension, which is invoked by a users' command, but does not grant access to interact with accessories in the same way as previous versions of the OS.
Posted
by Mcorey.
Last updated
.