Keychain can be used to persist some information. Typically, each app has its own Keychain Access. But sometimes you will need to share some information with multiple apps. You need to create Keychain Access Group.
Keychain Access Group needs to be created in the entitlements file. The default value is the appidentifierprefix+ project ID. The former is the prefix of the AppId, and for each developer, this is unique. We changed the project ID to a new group name. In the end it should look like this: $ (appidentifierprefix) newgroupname. This is then set up in each app Keychain Access group so that they belong to the same group and can share the Keychain.
In the code, if you want to save a string, use the setString forkey Service method. Instead, remove the string using the Stringforkey service method. Note that service is important. If the value of the service is not set, it cannot be shared.
IOS Keychain across Apps