HiveDrone

@objc open class HiveDrone: Operation

Represents an initialization node in the Hive system. This class should be subclassed to create a new node type.

  • Specifies if the operation is currently executing.

    Declaration

    Swift

    open override var isExecuting: Bool
  • Specifies if the operation is finished.

    Declaration

    Swift

    open override var isFinished: Bool
  • Specifies if the operation executes it’s task asynchronously.

    Declaration

    Swift

    open override var isConcurrent: Bool
  • Specifies if this is the first initialization attempt or if we are retrying the queue.

    Declaration

    Swift

    public private(set) var isRetrying: Bool
  • Gets the current progress of the process for this node. This is used so the client is able to get the total progress of all hive drones to show on a loading screen. This value should be between 0 - 1.

    Declaration

    Swift

    public var processProgress: Float = 0
  • Override this to alter the weight of a node used for determining the total progress of initilaization.

    Declaration

    Swift

    open var processWeight: Float
  • Specifies any dependencies to other nodes. The default is no dependencies, to specify dependencies a subclass should override this property and return an array containing the types of the nodes it depends on.

    override open var typeDependencies: [HiveDrone.Type] {
     get {
     return [DarkMatterNode.self]
     }
    }
    

    Declaration

    Swift

    open var typeDependencies: [HiveDrone.Type]
  • Initializes an instance of the HiveDrone class.

    Declaration

    Swift

    required public init(isRetrying: Bool)

    Parameters

    isRetrying

    true if this is not the first attempt to initialize the hive queue.

  • Begins execution of the operation.

    Declaration

    Swift

    open override func start()
  • Calling this indicates that the node has finished processing. This must be called by the subclass when it is finished or the initialization queue will never complete.

    Declaration

    Swift

    public func finish()
  • Called when the initialization queue begins processing but before any nodes have been processed.

    Declaration

    Swift

    open func preInitialize()
  • Will return the node to the preprocessed state.

    Declaration

    Swift

    open func reset()
  • This method is called to determine if the node should be processed on a reinitialization of the queue. If a node should not be processed after the first initialization then it should override this method and return false.

    Declaration

    Swift

    open func shouldRetry() -> Bool
  • Here is where the inheriting classes will handle their own logic that they want to happen when all their dependencies are met.

    Important

    The finish() method must be called when processing is complete.

    Declaration

    Swift

    open func processNode()