Refactor NexusDelegate to own file and rename to NexusEventDelegate

This commit is contained in:
Christian Treffs 2019-08-20 15:07:28 +02:00
parent ab785d666d
commit ccf18f6945
2 changed files with 16 additions and 8 deletions

View File

@ -5,13 +5,8 @@
// Created by Christian Treffs on 09.10.17. // Created by Christian Treffs on 09.10.17.
// //
public protocol NexusDelegate: class { public class Nexus {
func nexusEventOccurred(_ event: ECSEvent) public weak var delegate: NexusEventDelegate?
func nexusRecoverableErrorOccurred(_ message: String)
}
public class Nexus: Equatable {
public weak var delegate: NexusDelegate?
/// - Index: index value matching entity identifier shifted to Int /// - Index: index value matching entity identifier shifted to Int
/// - Value: each element is a entity instance /// - Value: each element is a entity instance
@ -62,8 +57,10 @@ public class Nexus: Equatable {
deinit { deinit {
clear() clear()
} }
}
// MARK: Equatable // MARK: - Equatable
extension Nexus: Equatable {
public static func == (lhs: Nexus, rhs: Nexus) -> Bool { public static func == (lhs: Nexus, rhs: Nexus) -> Bool {
return lhs.entityStorage == rhs.entityStorage && return lhs.entityStorage == rhs.entityStorage &&
lhs.componentIdsByEntity == rhs.componentIdsByEntity && lhs.componentIdsByEntity == rhs.componentIdsByEntity &&

View File

@ -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)
}