Assuming I have the following app identifier com.test.product1, which is of product1 offering a group id group.com.test.product1.
I am supposed to share a document to another product having com.test.product2 which is of product2 offering groupid group.com.test.product2.
How can I share a common group say like group.com.test.product between all of these applications?
You can store shared data using App Groups, but I've only tried to do this with built in types.
If you're trying to store your own classes you may need to look at something like NSKeyedArchiver and NSCoding (maybe look here).
If you can find a way to use the built in types you can use App Groups as follows:
Sharing NSUserDefaults data between multiple apps
In order to have shared defaults between an app and an extension or between 2 apps you have to add an App Group in your settings using the following steps:
Note: If you go to the Apple Developer Portal (the Apple website that shows all of your Certificates, Identifiers, Devices and Provisioning Profiles) and go to Identifiers > App Groups you should see this new App Group.
To store data:
var userDefaults = NSUserDefaults(suiteName: "group.com.company.myApp")
userDefaults!.setObject("user12345", forKey: "userId")
userDefaults!.synchronize()
To retrieve data:
var userDefaults = NSUserDefaults(suiteName: "group.com.company.myApp")
if let testUserId = userDefaults?.objectForKey("userId") as? String {
print("User Id: \(testUserId)")
}