Add SecureStorageSample Watch App

This commit is contained in:
Matt Bruce 2026-01-14 15:09:44 -06:00
parent c84b196250
commit 5d39a3336f
7 changed files with 46 additions and 10 deletions

View File

@ -1,5 +1,9 @@
#include "Project.xcconfig" #include "Project.xcconfig"
PRODUCT_BUNDLE_IDENTIFIER = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample PRODUCT_BUNDLE_IDENTIFIER = $(BASE_BUNDLE_ID)
INFOPLIST_KEY_CFBundleDisplayName = SecureStorage INFOPLIST_KEY_CFBundleDisplayName = SecureStorage
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES
INFOPLIST_KEY_BaseBundleID = $(BASE_BUNDLE_ID)
INFOPLIST_KEY_TeamID = $(TEAM_ID)
CODE_SIGN_ENTITLEMENTS = SecureStorageSample/SecureStorageSample.entitlements

View File

@ -1,7 +1,10 @@
// Shared project settings // Shared project settings
DEVELOPMENT_TEAM = 6R7KLBPBLZ DEVELOPMENT_TEAM = 6R7KLBPBLZ
TEAM_ID = $(DEVELOPMENT_TEAM)
MARKETING_VERSION = 1.0 MARKETING_VERSION = 1.0
CURRENT_PROJECT_VERSION = 1 CURRENT_PROJECT_VERSION = 1
// Default Bundle ID Prefix // Default Bundle ID Prefix
APP_BUNDLE_ID_PREFIX = com.mbrucedogs APP_BUNDLE_ID_PREFIX = com.mbrucedogs
BASE_BUNDLE_ID = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample
APP_GROUP_ID = group.$(BASE_BUNDLE_ID)

View File

@ -2,7 +2,11 @@
PRODUCT_BUNDLE_IDENTIFIER = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample.watchkitapp PRODUCT_BUNDLE_IDENTIFIER = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample.watchkitapp
INFOPLIST_KEY_CFBundleDisplayName = SecureStorage Watch INFOPLIST_KEY_CFBundleDisplayName = SecureStorage Watch
INFOPLIST_KEY_WKCompanionAppBundleIdentifier = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample INFOPLIST_KEY_WKCompanionAppBundleIdentifier = $(BASE_BUNDLE_ID)
SKIP_INSTALL = YES SKIP_INSTALL = YES
WATCHOS_DEPLOYMENT_TARGET = 10.0 WATCHOS_DEPLOYMENT_TARGET = 10.0
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES
INFOPLIST_KEY_BaseBundleID = $(BASE_BUNDLE_ID)
INFOPLIST_KEY_TeamID = $(TEAM_ID)
CODE_SIGN_ENTITLEMENTS = SecureStorageSample Watch App/SecureStorageSample Watch App.entitlements

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>$(APP_GROUP_ID)</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(BASE_BUNDLE_ID)</string>
</array>
</dict>
</plist>

View File

@ -670,7 +670,6 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = SecureStorageSample/SecureStorageSample.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
@ -701,7 +700,6 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = SecureStorageSample/SecureStorageSample.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;

View File

@ -4,7 +4,11 @@
<dict> <dict>
<key>com.apple.security.application-groups</key> <key>com.apple.security.application-groups</key>
<array> <array>
<string>group.com.mbrucedogs.securestorage</string> <string>$(APP_GROUP_ID)</string>
</array>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(BASE_BUNDLE_ID)</string>
</array> </array>
</dict> </dict>
</plist> </plist>

View File

@ -2,7 +2,16 @@ import Foundation
public enum StorageServiceIdentifiers { public enum StorageServiceIdentifiers {
public static var bundleIdentifier: String { public static var bundleIdentifier: String {
Bundle.main.bundleIdentifier ?? "com.example.securestorage" Bundle.main.object(forInfoDictionaryKey: "BaseBundleID") as? String ??
Bundle.main.bundleIdentifier ??
"com.example.securestorage"
}
private static var teamIDPrefix: String {
if let teamID = Bundle.main.object(forInfoDictionaryKey: "TeamID") as? String, !teamID.isEmpty {
return "\(teamID)."
}
return ""
} }
public static var appGroupIdentifier: String { public static var appGroupIdentifier: String {
@ -10,18 +19,18 @@ public enum StorageServiceIdentifiers {
} }
public static var keychainCredentials: String { public static var keychainCredentials: String {
bundleIdentifier "\(teamIDPrefix)\(bundleIdentifier)"
} }
public static var keychainAPIToken: String { public static var keychainAPIToken: String {
"\(bundleIdentifier).api" "\(teamIDPrefix)\(bundleIdentifier).api"
} }
public static var keychainExternalKeyMaterial: String { public static var keychainExternalKeyMaterial: String {
"\(bundleIdentifier).externalkey" "\(teamIDPrefix)\(bundleIdentifier).externalkey"
} }
public static var keychainLocation: String { public static var keychainLocation: String {
"\(bundleIdentifier).security" "\(teamIDPrefix)\(bundleIdentifier).security"
} }
} }