From 1ed0e2458577a90a3eed25e6dcc9b3f8ea338c7b Mon Sep 17 00:00:00 2001 From: Christian Treffs Date: Mon, 30 Sep 2019 20:37:03 +0200 Subject: [PATCH] Swiftlint --- Sources/FirebladeECS/Component+Access.swift | 2 +- Sources/FirebladeECS/Component.swift | 2 +- .../FirebladeECS/ComponentIdentifier.swift | 2 +- Sources/FirebladeECS/Entity+Component.swift | 34 +++++++++---------- Sources/FirebladeECS/Entity.swift | 2 +- Sources/FirebladeECS/Family.swift | 4 +-- Sources/FirebladeECS/Family1.swift | 6 ++-- Sources/FirebladeECS/Family2.swift | 2 +- Sources/FirebladeECS/Family3.swift | 2 +- Sources/FirebladeECS/Family4.swift | 4 +-- Sources/FirebladeECS/Family5.swift | 2 +- .../FamilyRequirementsManaging.swift | 2 +- Sources/FirebladeECS/Nexus+Family.swift | 32 ++++++++--------- Sources/FirebladeECS/NexusEventDelegate.swift | 2 +- Sources/FirebladeECS/NexusEvents.swift | 26 +++++++------- 15 files changed, 62 insertions(+), 62 deletions(-) diff --git a/Sources/FirebladeECS/Component+Access.swift b/Sources/FirebladeECS/Component+Access.swift index acd650e..1fd521f 100644 --- a/Sources/FirebladeECS/Component+Access.swift +++ b/Sources/FirebladeECS/Component+Access.swift @@ -1,6 +1,6 @@ // // Component+Access.swift -// +// // // Created by Christian Treffs on 25.06.19. // diff --git a/Sources/FirebladeECS/Component.swift b/Sources/FirebladeECS/Component.swift index b56345d..73dd567 100644 --- a/Sources/FirebladeECS/Component.swift +++ b/Sources/FirebladeECS/Component.swift @@ -15,6 +15,6 @@ public protocol Component: class { } public extension Component { - static var identifier: ComponentIdentifier { return ComponentIdentifier(Self.self) } + static var identifier: ComponentIdentifier { return ComponentIdentifier(Self.self) } @inlinable var identifier: ComponentIdentifier { return Self.identifier } } diff --git a/Sources/FirebladeECS/ComponentIdentifier.swift b/Sources/FirebladeECS/ComponentIdentifier.swift index 2c3b394..2ed9d57 100644 --- a/Sources/FirebladeECS/ComponentIdentifier.swift +++ b/Sources/FirebladeECS/ComponentIdentifier.swift @@ -1,6 +1,6 @@ // // ComponentIdentifier.swift -// +// // // Created by Christian Treffs on 20.08.19. // diff --git a/Sources/FirebladeECS/Entity+Component.swift b/Sources/FirebladeECS/Entity+Component.swift index fa8a70f..8eb0dbf 100644 --- a/Sources/FirebladeECS/Entity+Component.swift +++ b/Sources/FirebladeECS/Entity+Component.swift @@ -7,28 +7,28 @@ public extension Entity { @inlinable - func get() -> C? where C: Component { - return nexus.get(for: identifier) - } + func get() -> C? where C: Component { + return nexus.get(for: identifier) + } @inlinable - func get(component compType: A.Type = A.self) -> A? where A: Component { - return nexus.get(for: identifier) - } + func get(component compType: A.Type = A.self) -> A? where A: Component { + return nexus.get(for: identifier) + } @inlinable - func get(components _: A.Type, _: B.Type) -> (A?, B?) where A: Component, B: Component { - let compA: A? = get(component: A.self) - let compB: B? = get(component: B.self) - return (compA, compB) - } + func get(components _: A.Type, _: B.Type) -> (A?, B?) where A: Component, B: Component { + let compA: A? = get(component: A.self) + let compB: B? = get(component: B.self) + return (compA, compB) + } // swiftlint:disable large_tuple - @inlinable + @inlinable func get(components _: A.Type, _: B.Type, _: C.Type) -> (A?, B?, C?) where A: Component, B: Component, C: Component { - let compA: A? = get(component: A.self) - let compB: B? = get(component: B.self) - let compC: C? = get(component: C.self) - return (compA, compB, compC) - } + let compA: A? = get(component: A.self) + let compB: B? = get(component: B.self) + let compC: C? = get(component: C.self) + return (compA, compB, compC) + } } diff --git a/Sources/FirebladeECS/Entity.swift b/Sources/FirebladeECS/Entity.swift index 0b45535..7d68fa4 100644 --- a/Sources/FirebladeECS/Entity.swift +++ b/Sources/FirebladeECS/Entity.swift @@ -107,6 +107,6 @@ public struct Entity { extension Entity: Equatable { public static func == (lhs: Entity, rhs: Entity) -> Bool { return lhs.nexus == rhs.nexus && - lhs.identifier == rhs.identifier + lhs.identifier == rhs.identifier } } diff --git a/Sources/FirebladeECS/Family.swift b/Sources/FirebladeECS/Family.swift index cbfe10a..8d19398 100644 --- a/Sources/FirebladeECS/Family.swift +++ b/Sources/FirebladeECS/Family.swift @@ -1,6 +1,6 @@ // // Family.swift -// +// // // Created by Christian Treffs on 21.08.19. // @@ -127,6 +127,6 @@ extension Family.EntityComponentIterator: LazySequenceProtocol { } extension Family: Equatable { public static func == (lhs: Family, rhs: Family) -> Bool { return lhs.nexus == rhs.nexus && - lhs.traits == rhs.traits + lhs.traits == rhs.traits } } diff --git a/Sources/FirebladeECS/Family1.swift b/Sources/FirebladeECS/Family1.swift index d4bd37f..7af446a 100644 --- a/Sources/FirebladeECS/Family1.swift +++ b/Sources/FirebladeECS/Family1.swift @@ -1,6 +1,6 @@ // // Family1.swift -// +// // // Created by Christian Treffs on 21.08.19. // @@ -32,7 +32,7 @@ extension Nexus { excludesAll excludedComponents: Component.Type... ) -> Family1 where A: Component { return Family1(nexus: self, - requiresAll: componentA, - excludesAll: excludedComponents) + requiresAll: componentA, + excludesAll: excludedComponents) } } diff --git a/Sources/FirebladeECS/Family2.swift b/Sources/FirebladeECS/Family2.swift index afb470e..9e16251 100644 --- a/Sources/FirebladeECS/Family2.swift +++ b/Sources/FirebladeECS/Family2.swift @@ -1,6 +1,6 @@ // // Family2.swift -// +// // // Created by Christian Treffs on 21.08.19. // diff --git a/Sources/FirebladeECS/Family3.swift b/Sources/FirebladeECS/Family3.swift index 272b936..3db3d46 100644 --- a/Sources/FirebladeECS/Family3.swift +++ b/Sources/FirebladeECS/Family3.swift @@ -1,6 +1,6 @@ // // Family3.swift -// +// // // Created by Christian Treffs on 21.08.19. // diff --git a/Sources/FirebladeECS/Family4.swift b/Sources/FirebladeECS/Family4.swift index 68b1e5b..55177a2 100644 --- a/Sources/FirebladeECS/Family4.swift +++ b/Sources/FirebladeECS/Family4.swift @@ -1,6 +1,6 @@ // // Family4.swift -// +// // // Created by Christian Treffs on 21.08.19. // @@ -38,7 +38,7 @@ extension Nexus { _ componentC: C.Type, _ componentD: D.Type, excludesAll excludedComponents: Component.Type... - ) -> Family4 where A: Component, B: Component, C: Component, D: Component { + ) -> Family4 where A: Component, B: Component, C: Component, D: Component { return Family4( nexus: self, requiresAll: (componentA, componentB, componentC, componentD), diff --git a/Sources/FirebladeECS/Family5.swift b/Sources/FirebladeECS/Family5.swift index 20186f8..fad8865 100644 --- a/Sources/FirebladeECS/Family5.swift +++ b/Sources/FirebladeECS/Family5.swift @@ -1,6 +1,6 @@ // // Family5.swift -// +// // // Created by Christian Treffs on 21.08.19. // diff --git a/Sources/FirebladeECS/FamilyRequirementsManaging.swift b/Sources/FirebladeECS/FamilyRequirementsManaging.swift index 02970d2..157b77c 100644 --- a/Sources/FirebladeECS/FamilyRequirementsManaging.swift +++ b/Sources/FirebladeECS/FamilyRequirementsManaging.swift @@ -1,6 +1,6 @@ // // FamilyRequirementsManaging.swift -// +// // // Created by Christian Treffs on 21.08.19. // diff --git a/Sources/FirebladeECS/Nexus+Family.swift b/Sources/FirebladeECS/Nexus+Family.swift index 6d01a0c..1e19ceb 100644 --- a/Sources/FirebladeECS/Nexus+Family.swift +++ b/Sources/FirebladeECS/Nexus+Family.swift @@ -10,27 +10,27 @@ public extension Nexus { return familyMembersByTraits.keys.count } - func canBecomeMember(_ entity: Entity, in traits: FamilyTraitSet) -> Bool { - guard let componentIds = componentIdsByEntity[entity.identifier] else { - assertionFailure("no component set defined for entity: \(entity)") - return false - } - return traits.isMatch(components: componentIds) - } + func canBecomeMember(_ entity: Entity, in traits: FamilyTraitSet) -> Bool { + guard let componentIds = componentIdsByEntity[entity.identifier] else { + assertionFailure("no component set defined for entity: \(entity)") + return false + } + return traits.isMatch(components: componentIds) + } - func members(withFamilyTraits traits: FamilyTraitSet) -> UnorderedSparseSet { - return familyMembersByTraits[traits] ?? UnorderedSparseSet() - } + func members(withFamilyTraits traits: FamilyTraitSet) -> UnorderedSparseSet { + return familyMembersByTraits[traits] ?? UnorderedSparseSet() + } - func isMember(_ entity: Entity, in family: FamilyTraitSet) -> Bool { - return isMember(entity.identifier, in: family) - } + func isMember(_ entity: Entity, in family: FamilyTraitSet) -> Bool { + return isMember(entity.identifier, in: family) + } func isMember(_ entityId: EntityIdentifier, in family: FamilyTraitSet) -> Bool { return isMember(entity: entityId, inFamilyWithTraits: family) } - func isMember(entity entityId: EntityIdentifier, inFamilyWithTraits traits: FamilyTraitSet) -> Bool { - return members(withFamilyTraits: traits).contains(entityId.index) - } + func isMember(entity entityId: EntityIdentifier, inFamilyWithTraits traits: FamilyTraitSet) -> Bool { + return members(withFamilyTraits: traits).contains(entityId.index) + } } diff --git a/Sources/FirebladeECS/NexusEventDelegate.swift b/Sources/FirebladeECS/NexusEventDelegate.swift index c9ca461..72bf4c7 100644 --- a/Sources/FirebladeECS/NexusEventDelegate.swift +++ b/Sources/FirebladeECS/NexusEventDelegate.swift @@ -1,6 +1,6 @@ // // NexusEventDelegate.swift -// +// // // Created by Christian Treffs on 20.08.19. // diff --git a/Sources/FirebladeECS/NexusEvents.swift b/Sources/FirebladeECS/NexusEvents.swift index 08a136c..ff7070f 100644 --- a/Sources/FirebladeECS/NexusEvents.swift +++ b/Sources/FirebladeECS/NexusEvents.swift @@ -8,41 +8,41 @@ public protocol NexusEvent {} public struct EntityCreated: NexusEvent { - public let entityId: EntityIdentifier + public let entityId: EntityIdentifier } public struct EntityDestroyed: NexusEvent { - public let entityId: EntityIdentifier + public let entityId: EntityIdentifier } public struct ComponentAdded: NexusEvent { - public let component: ComponentIdentifier - public let toEntity: EntityIdentifier + public let component: ComponentIdentifier + public let toEntity: EntityIdentifier } public struct ComponentUpdated: NexusEvent { - public let atEnity: EntityIdentifier + public let atEnity: EntityIdentifier } public struct ComponentRemoved: NexusEvent { - public let component: ComponentIdentifier - public let from: EntityIdentifier + public let component: ComponentIdentifier + public let from: EntityIdentifier } public struct FamilyMemberAdded: NexusEvent { - public let member: EntityIdentifier - public let toFamily: FamilyTraitSet + public let member: EntityIdentifier + public let toFamily: FamilyTraitSet } public struct FamilyMemberRemoved: NexusEvent { - public let member: EntityIdentifier - public let from: FamilyTraitSet + public let member: EntityIdentifier + public let from: FamilyTraitSet } public struct FamilyCreated: NexusEvent { - public let family: FamilyTraitSet + public let family: FamilyTraitSet } public struct FamilyDestroyed: NexusEvent { - public let family: FamilyTraitSet + public let family: FamilyTraitSet }