An experimental conversion of Apple's sample code "HomeKit Catalog: Creating Homes, Pairing and Controlling Accessories, and Setting Up Triggers" in Swift 2.3 into Swift 5 (Sorry for the mismatching repository name, I thought Apple would release the new version before Swift 4 was out.)
The sample project is a universal build, but doesn't work properly on iPad. When you press "Add Trigger" on iPad, the modal menu that displays just fine on iPhone causes a constraint-related exception. This is fixed by proper use of the popoverPresentationController, in this case by specifying sourceView and sourceRect.
The sample project is a universal build, but doesn't work properly on iPad. When you press "Add Trigger" on iPad, the modal menu that displays just fine on iPhone causes a constraint-related exception. This is fixed by proper use of the popoverPresentationController, in this case by specifying sourceView and sourceRect.