From 0f467125393a5b1f63f7856132ca2e446eea92b8 Mon Sep 17 00:00:00 2001 From: Muukii Date: Tue, 9 Apr 2024 02:31:59 +0900 Subject: [PATCH] Patch --- Sources/VergeSwiftUI/Info.plist | 22 ----- Sources/VergeSwiftUI/VergeSwiftUI.h | 19 ----- Sources/VergeTypedIdentifier/EntityType.swift | 48 ++--------- .../PrimitiveIdentifier.swift | 80 ------------------- 4 files changed, 5 insertions(+), 164 deletions(-) delete mode 100644 Sources/VergeSwiftUI/Info.plist delete mode 100644 Sources/VergeSwiftUI/VergeSwiftUI.h delete mode 100644 Sources/VergeTypedIdentifier/PrimitiveIdentifier.swift diff --git a/Sources/VergeSwiftUI/Info.plist b/Sources/VergeSwiftUI/Info.plist deleted file mode 100644 index 9bcb244429..0000000000 --- a/Sources/VergeSwiftUI/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - - diff --git a/Sources/VergeSwiftUI/VergeSwiftUI.h b/Sources/VergeSwiftUI/VergeSwiftUI.h deleted file mode 100644 index fa17594c0a..0000000000 --- a/Sources/VergeSwiftUI/VergeSwiftUI.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// VergeSwiftUI.h -// VergeSwiftUI -// -// Created by muukii on 2020/06/04. -// Copyright © 2020 muukii. All rights reserved. -// - -#import - -//! Project version number for VergeSwiftUI. -FOUNDATION_EXPORT double VergeSwiftUIVersionNumber; - -//! Project version string for VergeSwiftUI. -FOUNDATION_EXPORT const unsigned char VergeSwiftUIVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/Sources/VergeTypedIdentifier/EntityType.swift b/Sources/VergeTypedIdentifier/EntityType.swift index 2cac7b9da4..0047dec00d 100644 --- a/Sources/VergeTypedIdentifier/EntityType.swift +++ b/Sources/VergeTypedIdentifier/EntityType.swift @@ -19,71 +19,33 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -import Foundation - -public struct AnyEntityIdentifier: Hashable, Sendable { - - public typealias StringLiteralType = String - - public let value: PrimitiveIdentifier - public init(_ value: PrimitiveIdentifier) { - self.value = value - } - -} - public struct EntityIdentifier : Hashable, CustomStringConvertible, Sendable { - + public static func == (lhs: Self, rhs: Self) -> Bool { lhs.raw == rhs.raw } - + public func hash(into hasher: inout Hasher) { raw.hash(into: &hasher) } - public let any: AnyEntityIdentifier - public let raw: Entity.EntityIDRawType - public init(_ raw: Entity.EntityIDRawType) { + public init(_ raw: consuming Entity.EntityIDRawType) { self.raw = raw - self.any = .init(raw._primitiveIdentifier) } - - @_spi(ForORM) - public init(_ anyIdentifier: AnyEntityIdentifier) { - self.any = anyIdentifier - self.raw = Entity.EntityIDRawType._restore(from: anyIdentifier.value)! - } - + public var description: String { "<\(String(reflecting: Entity.self))>(\(raw))" } } /// A protocol describes object is an Entity. -/// -/// EntityType has VergeTypedIdentifiable. -/// You might use IdentifiableEntityType instead, if you create SwiftUI app. public protocol EntityType: Equatable, Sendable { - associatedtype EntityIDRawType: _PrimitiveIdentifierConvertible + associatedtype EntityIDRawType: Hashable, Sendable var entityID: EntityID { get } typealias EntityID = EntityIdentifier } - -public struct EntityTableIdentifier: Hashable { - - public let name: String - - public init(_ rawName: String) { - self.name = rawName - } - - public init(_ type: T.Type) { - self.name = _typeName(T.self) - } -} diff --git a/Sources/VergeTypedIdentifier/PrimitiveIdentifier.swift b/Sources/VergeTypedIdentifier/PrimitiveIdentifier.swift deleted file mode 100644 index 650d265230..0000000000 --- a/Sources/VergeTypedIdentifier/PrimitiveIdentifier.swift +++ /dev/null @@ -1,80 +0,0 @@ - -public enum PrimitiveIdentifier: Hashable, Sendable { - - case string(String) - case int64(Int64) - case uint64(UInt64) - case int(Int) - -} - -public protocol _PrimitiveIdentifierConvertible: Hashable, Sendable { - - var _primitiveIdentifier: PrimitiveIdentifier { get } - - static func _restore(from primitiveIdentifier: PrimitiveIdentifier) -> Self? - -} - -extension String: _PrimitiveIdentifierConvertible { - - @inline(__always) - public var _primitiveIdentifier: PrimitiveIdentifier { - return .string(self) - } - - @inline(__always) - public static func _restore(from primitiveIdentifier: PrimitiveIdentifier) -> Self? { - guard case .string(let value) = primitiveIdentifier else { - return nil - } - return value - } -} - -extension Int64: _PrimitiveIdentifierConvertible { - - @inline(__always) - public var _primitiveIdentifier: PrimitiveIdentifier { - return .int64(self) - } - - @inline(__always) - public static func _restore(from primitiveIdentifier: PrimitiveIdentifier) -> Self? { - guard case .int64(let value) = primitiveIdentifier else { - return nil - } - return value - } -} - -extension UInt64: _PrimitiveIdentifierConvertible { - - @inline(__always) - public var _primitiveIdentifier: PrimitiveIdentifier { - return .uint64(self) - } - - @inline(__always) - public static func _restore(from primitiveIdentifier: PrimitiveIdentifier) -> Self? { - guard case .uint64(let value) = primitiveIdentifier else { - return nil - } - return value - } -} -extension Int: _PrimitiveIdentifierConvertible { - - @inline(__always) - public var _primitiveIdentifier: PrimitiveIdentifier { - return .int(self) - } - - @inline(__always) - public static func _restore(from primitiveIdentifier: PrimitiveIdentifier) -> Self? { - guard case .int(let value) = primitiveIdentifier else { - return nil - } - return value - } -}