FYI: GroupStateObserver is refreshing isEligibleForGroupSession asynchronously. So it's not holding the correct value after initializing it. This isn't well documented.
The way to use this is to hold an instance of GroupStateObserver somewhere. Keep in mind that the initial value won't be correct, when launching the app during a FaceTime call. You can use the publisher to be notified of updates. The publisher fires before the state updates (objectWillChange) and in next RunTime loop the Bool should be updated.
In the WWDC session the observer is wrapped as @StateObject to only initialize the GroupStateObserver once during the view lifetime and to update the view, when the objectWillChange publisher of the GroupStateObserver fires.
let eligible = GroupStateObserver().isEligibleForGroupSession // won't work, always false
Topic:
App & System Services
SubTopic:
Core OS
Tags: