From 021dda7f5574e7bcbce71a7b26dda5241f6d6c0f Mon Sep 17 00:00:00 2001 From: "jcp.air" Date: Tue, 16 Jun 2026 18:12:47 +0200 Subject: [PATCH 1/3] [identifier] don't use a string --- Sources/CohesionKit/Identifier.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Sources/CohesionKit/Identifier.swift b/Sources/CohesionKit/Identifier.swift index 9d36d63..dd3e684 100644 --- a/Sources/CohesionKit/Identifier.swift +++ b/Sources/CohesionKit/Identifier.swift @@ -22,4 +22,17 @@ struct Identifier: Hashable, Sendable, ExpressibleByStringLiteral { init(for type: T.Type, key: AliasKey) { self.init("alias:\(T.self):\(key.name)") } + init(for type: T.Type, key: K) { + self.objectType = ObjectIdentifier(type) + self.key = AnyHashable(key) + } + + init(for object: T) { + self.init(for: T.self, key: object.id) + } + + init(for type: T.Type, key: AliasKey) { + self.objectType = ObjectIdentifier(AliasContainer.self) + self.key = AnyHashable(key.name) + } } From 4dff6a8ec2d181c90ca95e05abafcffb08b59c71 Mon Sep 17 00:00:00 2001 From: "jcp.air" Date: Tue, 16 Jun 2026 18:25:01 +0200 Subject: [PATCH 2/3] [example] updated pbx --- Example/Example.xcodeproj/project.pbxproj | 13 +++++++++---- .../xcshareddata/xcschemes/Example.xcscheme | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index c176588..06b2d75 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -137,8 +137,9 @@ 49F4DD4526448849004E511B /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 1240; - LastUpgradeCheck = 1240; + LastUpgradeCheck = 2700; TargetAttributes = { 49F4DD4C26448849004E511B = { CreatedOnToolsVersion = 12.4; @@ -240,6 +241,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -259,6 +261,7 @@ MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; @@ -301,6 +304,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -313,6 +317,7 @@ MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; + STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; @@ -328,7 +333,7 @@ DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\""; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = Example/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = "$(RECOMMENDED_IPHONEOS_DEPLOYMENT_TARGET)"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -349,7 +354,7 @@ DEVELOPMENT_ASSET_PATHS = "\"Example/Preview Content\""; ENABLE_PREVIEWS = YES; INFOPLIST_FILE = Example/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IPHONEOS_DEPLOYMENT_TARGET = "$(RECOMMENDED_IPHONEOS_DEPLOYMENT_TARGET)"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme index cc28b85..f65ad30 100644 --- a/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme +++ b/Example/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme @@ -1,6 +1,6 @@ Date: Tue, 16 Jun 2026 18:25:16 +0200 Subject: [PATCH 3/3] [identifier] fix convenience init --- Sources/CohesionKit/Identifier.swift | 31 ++++++---------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/Sources/CohesionKit/Identifier.swift b/Sources/CohesionKit/Identifier.swift index dd3e684..15951c7 100644 --- a/Sources/CohesionKit/Identifier.swift +++ b/Sources/CohesionKit/Identifier.swift @@ -1,28 +1,10 @@ /// a unique identifier to observe an object -struct Identifier: Hashable, Sendable, ExpressibleByStringLiteral { - let identifier: String +struct Identifier: Hashable { + private let objectType: ObjectIdentifier + private let key: AnyHashable - init(_ identifier: String) { - self.identifier = identifier - } - - init(stringLiteral value: StringLiteralType) { - self.init(value) - } - - /// Generates an identifier for type T with key as key - init(for type: T.Type, key: Any) { - self.init("\(T.self):\(key)") - } - - init(for object: T) { - self.init(for: T.self, key: object.id) - } - - init(for type: T.Type, key: AliasKey) { - self.init("alias:\(T.self):\(key.name)") - } - init(for type: T.Type, key: K) { + /// Generates an identifier for type T with key as key + init(for type: T.Type, key: some Hashable) { self.objectType = ObjectIdentifier(type) self.key = AnyHashable(key) } @@ -32,7 +14,6 @@ struct Identifier: Hashable, Sendable, ExpressibleByStringLiteral { } init(for type: T.Type, key: AliasKey) { - self.objectType = ObjectIdentifier(AliasContainer.self) - self.key = AnyHashable(key.name) + self.init(for: AliasContainer.self, key: key.name) } }