Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -137,8 +137,9 @@
49F4DD4526448849004E511B /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1240;
LastUpgradeCheck = 2700;
TargetAttributes = {
49F4DD4C26448849004E511B = {
CreatedOnToolsVersion = 12.4;
Expand Down Expand Up @@ -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;
Expand All @@ -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";
};
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1240"
LastUpgradeVersion = "2700"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
34 changes: 14 additions & 20 deletions Sources/CohesionKit/Identifier.swift
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
/// 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
}
/// Generates an identifier for type T with key as key
init<T>(for type: T.Type, key: some Hashable) {
self.objectType = ObjectIdentifier(type)
self.key = AnyHashable(key)
}

init(stringLiteral value: StringLiteralType) {
self.init(value)
}
init<T: Identifiable>(for object: T) {
self.init(for: T.self, key: object.id)
}

/// Generates an identifier for type T with key as key
init<T>(for type: T.Type, key: Any) {
self.init("\(T.self):\(key)")
}

init<T: Identifiable>(for object: T) {
self.init(for: T.self, key: object.id)
}

init<T>(for type: T.Type, key: AliasKey<T>) {
self.init("alias:\(T.self):\(key.name)")
}
init<T>(for type: T.Type, key: AliasKey<T>) {
self.init(for: AliasContainer<T>.self, key: key.name)
}
}
Loading