diff --git a/Sources/FirebladeECS/Component+Access.swift b/Sources/FirebladeECS/Component+Access.swift index 054fd25..acd650e 100644 --- a/Sources/FirebladeECS/Component+Access.swift +++ b/Sources/FirebladeECS/Component+Access.swift @@ -5,6 +5,7 @@ // Created by Christian Treffs on 25.06.19. // +#if swift(>=5.1) @dynamicMemberLookup public struct ReadableOnly where Comp: Component { @usableFromInline let component: Comp @@ -31,3 +32,4 @@ public struct Writable where Comp: Component { nonmutating set { component[keyPath: keyPath] = newValue } } } +#endif diff --git a/Sources/FirebladeECS/Entity.swift b/Sources/FirebladeECS/Entity.swift index ad48690..0b45535 100644 --- a/Sources/FirebladeECS/Entity.swift +++ b/Sources/FirebladeECS/Entity.swift @@ -104,4 +104,9 @@ public struct Entity { } // MARK: - Equatable -extension Entity: Equatable { } +extension Entity: Equatable { + public static func == (lhs: Entity, rhs: Entity) -> Bool { + return lhs.nexus == rhs.nexus && + lhs.identifier == rhs.identifier + } +} diff --git a/Sources/FirebladeECS/Family.swift b/Sources/FirebladeECS/Family.swift index a122402..cbfe10a 100644 --- a/Sources/FirebladeECS/Family.swift +++ b/Sources/FirebladeECS/Family.swift @@ -124,4 +124,9 @@ extension Family { extension Family.EntityComponentIterator: LazySequenceProtocol { } // MARK: - Equatable -extension Family: Equatable { } +extension Family: Equatable { + public static func == (lhs: Family, rhs: Family) -> Bool { + return lhs.nexus == rhs.nexus && + lhs.traits == rhs.traits + } +} diff --git a/Tests/FirebladeECSTests/AccessTests.swift b/Tests/FirebladeECSTests/AccessTests.swift index 423ceb8..d5fbcd3 100644 --- a/Tests/FirebladeECSTests/AccessTests.swift +++ b/Tests/FirebladeECSTests/AccessTests.swift @@ -10,7 +10,7 @@ import FirebladeECS import XCTest - +#if swift(>=5.1) class AccessTests: XCTestCase { func testReadOnly() { @@ -42,3 +42,4 @@ class AccessTests: XCTestCase { } } +#endif