I am in the process of creating a multiplatform app with a shared code base using swiftUI for iOS and mac. This app has a widget extension target for both iOS and mac and a helper app for mac only. I am trying to share data and userdefaults between the main app and the widget extension for ios, and for the mac share data between the main app, widget extension and the helper app.
I have setup an app group container to share data between all targets. However this is only working on iOS. The app group capability is not extended to macOS.
I have been researching for weeks now and all the answers I can find are for if the macOS were a different target, which would entail me having the macos group container prefixed with my team identifier.
With a multiplatform app, the main app simply won't let me prefix the group container with my team identifier. Which unfortunately xcode prevents me from doing for a multiplatform app.
I have no idea of how to solve this issue and any help will be appreciated.
Yeah, this is annoying. To start, I recommend that you read App Groups: macOS vs iOS: Fight! for a bunch of backstory.
In the multi-platform app case, I don’t think that the Signing & Capabilities editor is up to this task. I’m pretty sure we have a bug against Xcode about this already, but it wouldn’t hurt for you to file your own. If you do, please post your bug number, just for the record.
I’m not entirely sure of the best way to resolve this. I think you might end up needing a platform-specific .entitlements
file, but I’ve not had time to sit down and test that.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"