SCKView

@objc public class SCKView: NSView

An abstract NSView subclass that implements the basic functionality to manage a set of event views provided by an SCKViewController object. This class provides basic handling of the displayed date interval and methods to convert between these date values and view coordinates.

In addition, SCKView provides the default (and required) implementation for event coloring, selection and deselection, handling double clicks on empty dates and drag & drop.

Note

Do not instantiate this class directly.
  • The displayed date interval. Setting this value marks the view as needing display. You should call a reload data method on the controller object to provide matching events after calling this method.

    Declaration

    Swift

    public var dateInterval: DateInterval = DateInterval()
  • The portion of the view used to display events. Defaults to the full view frame. Subclasses override this property if they display additional items such as day or hour labels alongside the event views.

    Declaration

    Swift

    public var contentRect: CGRect
  • Override this method to perform additional tasks before the layout invalidation takes place. If you do so, don’t forget to call super.

    Declaration

    Swift

    public func beginLayoutInvalidation()
  • Override this method to perform additional tasks after the layout invalidation has finished. If you do so, don’t forget to call super.

    Declaration

    Swift

    public func endLayoutInvalidation()
  • Triggers a series of operations that determine the frame of an array of SCKEventViews according to their event holder’s properties and to other events which could be potentially in conflict with them. Eventually, the schedule view is marked as needing layout in order to perform the actual subview positioning and sizing.

    These opertations include freezing all subviews’ event holder to guarantee that their data remains consistent during the whole process even if their represented object properties change.

    • Parameters:
      • eventViews: The array of event views to be laid out.
      • animated: Pass true to perform an animated subview layout.

    Declaration

    Swift

    public final func invalidateLayout(for eventViews: [SCKEventView], animated: Bool = false)

    Parameters

    eventViews

    The array of event views to be laid out.

    animated

    Pass true to perform an animated subview layout.

  • A convenience method to trigger layout invalidation for all event views.

    Parameter

    Parameter animated: Pass true to perform an animated subview layout.

    Declaration

    Swift

    public final func invalidateLayoutForAllEventViews(animated: Bool = false)

    Parameters

    animated

    Pass true to perform an animated subview layout.

  • The color style used to draw the different event views. Setting this value to a different style marks event views as needing display.

    Declaration

    Swift

    @objc public var colorMode: SCKEventColorMode = .byEventKind
  • The currently selected event view or nil if none. Setting this value may trigger the scheduleControllerDidClearSelection(_:) and/or the scheduleController(_:didSelectEvent:) methods on the controller`s event manager when appropiate. In addition, it marks all event views as needing display in order to make them reflect the current selection.

    Declaration

    Swift

    public weak var selectedEventView: SCKEventView?
  • Undocumented

    Declaration

    Swift

    @objc public class SCKView: NSView