From 849110f8cc2fc61b054d7fba6f89a85944a73919 Mon Sep 17 00:00:00 2001 From: Christian Treffs Date: Fri, 7 Aug 2020 09:47:25 +0200 Subject: [PATCH] Cleanup and document family API --- Sources/FirebladeECS/Family.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/FirebladeECS/Family.swift b/Sources/FirebladeECS/Family.swift index eb7cd73..27ec0e6 100644 --- a/Sources/FirebladeECS/Family.swift +++ b/Sources/FirebladeECS/Family.swift @@ -17,14 +17,16 @@ public struct Family where R: FamilyRequirementsManaging { nexus.onFamilyInit(traits: traits) } - @inlinable public var memberIds: UnorderedSparseSet { + @inlinable var memberIds: UnorderedSparseSet { nexus.members(withFamilyTraits: traits) } + /// Returns the number of family member entities. @inlinable public var count: Int { memberIds.count } + /// True if this family has no members; false otherwise. @inlinable public var isEmpty: Bool { memberIds.isEmpty } @@ -55,7 +57,7 @@ extension Family: Equatable { } extension Family: Sequence { - __consuming public func makeIterator() -> ComponentsIterator { + public func makeIterator() -> ComponentsIterator { ComponentsIterator(family: self) } }