38 lines
1.3 KiB
Swift
38 lines
1.3 KiB
Swift
import Foundation
|
|
|
|
/// Centralized identifiers for the App Clip.
|
|
/// Reads from Info.plist which gets values from xcconfig at build time.
|
|
///
|
|
/// The source of truth is `BusinessCard/Configuration/Base.xcconfig`.
|
|
/// The App Clip inherits these values through its own xcconfig.
|
|
enum ClipIdentifiers {
|
|
|
|
/// CloudKit container identifier.
|
|
/// Must match the main app's container to access shared cards.
|
|
static let cloudKitContainerIdentifier: String = {
|
|
Bundle.main.object(forInfoDictionaryKey: "CloudKitContainerIdentifier") as? String
|
|
?? "iCloud.$(COMPANY_IDENTIFIER).$(BUNDLE_ID_NAME)"
|
|
}()
|
|
|
|
/// App Clip domain for URL handling.
|
|
static let appClipDomain: String = {
|
|
Bundle.main.object(forInfoDictionaryKey: "AppClipDomain") as? String
|
|
?? "topdoglabs.com"
|
|
}()
|
|
|
|
/// Bundle identifier of the App Clip.
|
|
static var bundleIdentifier: String {
|
|
Bundle.main.bundleIdentifier ?? "$(APPCLIP_BUNDLE_IDENTIFIER)"
|
|
}
|
|
|
|
/// Parent app bundle identifier.
|
|
static var parentBundleIdentifier: String {
|
|
// Remove ".Clip" suffix to get parent bundle ID
|
|
let clipSuffix = ".Clip"
|
|
if bundleIdentifier.hasSuffix(clipSuffix) {
|
|
return String(bundleIdentifier.dropLast(clipSuffix.count))
|
|
}
|
|
return bundleIdentifier
|
|
}
|
|
}
|