SCKEventRequest

@objc public class SCKEventRequest: NSObject

The SCKEventRequest class represents a wrapper type used by an SCKViewController object to encapsulate relevant info and to handle new events when reloading events asynchronously.

Asynchronous event loading is disabled by default. You may enable it by setting SCKViewController’s loadsEventsAsynchronously to true. When this option is enabled, the events(from:to:for:) method won’t be called on the event manager. Instead, scheduleController(_:didMakeEventRequest:) will get called with this object as a parameter. The event manager is responsible of keeping a (weak) reference to this request, loading the appropiate events asynchronously and, eventually, passing them back to the request on the main queue via the complete(with:) method.

  • Cancels the request if not canceled yet. This will make it ignore any subsequent calls to complete(with:). In addition, the request will be released by its owning SCKViewController object, so if you don’t own any other strong references to it, it will be also deallocated.

    Declaration

    Swift

    @objc public func cancel()
  • If not canceled or already completed, fulfills the request passing back the suitable SCKEvent objects to the owning SCKViewController. In addition, the request will be released by its owning SCKViewController object, so if you don’t own any other strong references to it, it will be also deallocated.

    Parameter

    Parameter events: The asynchronously loaded events.

    Warning

    This method must be called from the main thread.

    Declaration

    Swift

    @objc public func complete(with events: [SCKEvent])

    Parameters

    events

    The asynchronously loaded events.