From ccf18f69459a55ff3f3ee79693c800b2019dcabb Mon Sep 17 00:00:00 2001 From: Christian Treffs Date: Tue, 20 Aug 2019 15:07:28 +0200 Subject: [PATCH] Refactor NexusDelegate to own file and rename to NexusEventDelegate --- Sources/FirebladeECS/Nexus.swift | 13 +++++-------- Sources/FirebladeECS/NexusEventDelegate.swift | 11 +++++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 Sources/FirebladeECS/NexusEventDelegate.swift diff --git a/Sources/FirebladeECS/Nexus.swift b/Sources/FirebladeECS/Nexus.swift index e44830d..bb25c86 100644 --- a/Sources/FirebladeECS/Nexus.swift +++ b/Sources/FirebladeECS/Nexus.swift @@ -5,13 +5,8 @@ // Created by Christian Treffs on 09.10.17. // -public protocol NexusDelegate: class { - func nexusEventOccurred(_ event: ECSEvent) - func nexusRecoverableErrorOccurred(_ message: String) -} - -public class Nexus: Equatable { - public weak var delegate: NexusDelegate? +public class Nexus { + public weak var delegate: NexusEventDelegate? /// - Index: index value matching entity identifier shifted to Int /// - Value: each element is a entity instance @@ -62,8 +57,10 @@ public class Nexus: Equatable { deinit { clear() } +} - // MARK: Equatable +// MARK: - Equatable +extension Nexus: Equatable { public static func == (lhs: Nexus, rhs: Nexus) -> Bool { return lhs.entityStorage == rhs.entityStorage && lhs.componentIdsByEntity == rhs.componentIdsByEntity && diff --git a/Sources/FirebladeECS/NexusEventDelegate.swift b/Sources/FirebladeECS/NexusEventDelegate.swift new file mode 100644 index 0000000..0867fff --- /dev/null +++ b/Sources/FirebladeECS/NexusEventDelegate.swift @@ -0,0 +1,11 @@ +// +// NexusEventDelegate.swift +// +// +// Created by Christian Treffs on 20.08.19. +// + +public protocol NexusEventDelegate: class { + func nexusEventOccurred(_ event: ECSEvent) + func nexusRecoverableErrorOccurred(_ message: String) +}