RVS_CalendarInput

open class RVS_CalendarInput : UIView

This is a customized UIView implementation, that will display a basic month/grid calendar, with active buttons, on selected dates. The idea is to present a simple, intuitive interface, much like the classic “booking” interfaces, presented by Web sites.

The control does not derive from UIControl, as the event targeting system would not be useful for the types of interactions that can occur with this control. Instead, the implementor should register as a delegate (RVS_CalendarInputDelegate), and receive messages, when the control is used. The implementor can always examine the data array, and detrmine the control state. That array is updated in realtime.

Public State Properties That Cannot Be Changed At Runtime

  • This contains the data that defines the state of this control. This will have every day shown by the control; not just the ones passed in. READ-ONLY

    Declaration

    Swift

    public var data: [RVS_CalendarInputDateItemProtocol] { get }

Public State Properties That Can Be Changed At Runtime

  • The height, in display units, of the weekday header. We “hardcode” this, because dynamically calculating it is crazy slow.

    Declaration

    Swift

    public var weekdayHeaderHeightInDisplayUnits: CGFloat { get set }
  • The height, in display units, of the year header. We “hardcode” this, because dynamically calculating it is crazy slow.

    Declaration

    Swift

    public var yearHeaderHeightInDisplayUnits: CGFloat { get set }
  • The height, in display units, of the month header. We “hardcode” this, because dynamically calculating it is crazy slow.

    Declaration

    Swift

    public var monthHeaderHeightInDisplayUnits: CGFloat { get set }
  • This contains the calendar used for the control. It defaults to the current calendar, but can be changed.

    Declaration

    Swift

    public var calendar: Calendar { get set }
  • The font to be used for the weekday header, at the top.

    Declaration

    Swift

    public var weekdayHeaderFont: UIFont { get set }
  • The font to be used for the year header.

    Declaration

    Swift

    public var yearHeaderFont: UIFont { get set }
  • The font to be used for the month header.

    Declaration

    Swift

    public var monthHeaderFont: UIFont { get set }
  • The font to be used for each of the days.

    Declaration

    Swift

    public var weekdayFont: UIFont { get set }
  • This is the color for the background of unselected and enabled days. The UIView.tintColor property is used to set the font color for the enabled days (and becomes the background, when the day is selected). If the day is selected, this becomes the font color.

    Declaration

    Swift

    public var enabledItemBackgroundColor: UIColor { get set }
  • The font to be used for the weekday header, at the top.

    Declaration

    Swift

    public var weekdayHeaderFontColor: UIColor { get set }
  • The font color to be used for the year header.

    Declaration

    Swift

    public var yearHeaderFontColor: UIColor { get set }
  • The font color to be used for the month header.

    Declaration

    Swift

    public var monthHeaderFontColor: UIColor { get set }
  • The background color to be used for the year header.

    Declaration

    Swift

    public var yearHeaderBackgroundColor: UIColor { get set }
  • The background color to be used for the month header.

    Declaration

    Swift

    public var monthHeaderBackgroundColor: UIColor { get set }
  • The opacity of disabled date buttons.

    Declaration

    Swift

    public var disabledAlpha: CGFloat { get set }
  • If this is false (default is true), then the month headers will not be shown.

    Declaration

    Swift

    @IBInspectable
    public var showMonthHeaders: Bool { get set }
  • If this is false (default is true), then the year headers will not be shown.

    Declaration

    Swift

    @IBInspectable
    public var showYearHeaders: Bool { get set }
  • If this is false (default is true), then the weekday header will not be shown.

    Declaration

    Swift

    @IBInspectable
    public var showWeekdayHeader: Bool { get set }
  • If this is true (default is false), then each day button acts in a “momentary” fashion, and the control does not leave the day selected. All days will appear as unselected, when “at rest.”

    Declaration

    Swift

    @IBInspectable
    public var readOnlyMode: Bool { get set }

Delegate

  • This is the delegate that is used to receive notifications of date items changing. The delegate needs to be a class, and this is a weak reference. This is not IB-accessible, because we don’t want to require delegates to conform to NSObjectProtocol

    Declaration

    Swift

    public weak var delegate: RVS_CalendarInputDelegate?

Scroll View

  • The scroller that will contain the view.

    Declaration

    Swift

    public weak var scrollView: UIScrollView?

Public Computed Properties

  • This is basically a write-only way to set up the control. Read will always return an empty array. This contains the particular dates that you want to affect. The date range of the control will be determined from these data. Setting this value will re-initialize the control. This copies the data. It does not make references to it.

    Declaration

    Swift

    public var setupData: [RVS_CalendarInputDateItemProtocol] { get set }

Public Convenience Initializer

  • This allows the instance to be instantiated with an initial frame and/or initial data and/or a delegate.

    Declaration

    Swift

    public convenience init(frame inFrame: CGRect = .zero,
                            setUpData inSetupData: [RVS_CalendarInputDateItemProtocol] = [],
                            delegate inDelegate: RVS_CalendarInputDelegate? = nil)

    Parameters

    frame

    An initial frame. OPTIONAL

    setUpData

    This is an array of initial date objects that will be used. OPTIONAL

    delegate

    A delegate for this instance. OPTIONAL

Public Base Class Overrides

  • Called when we will lay out our view hierarchy.

    Declaration

    Swift

    override func layoutSubviews()

Public Date Item Class (One element of the data array)

  • This is one element of the data that is provided to, and read from, the view.

    This is a class, as opposed to a struct, because we rely on reference semantics to set and get state.

    See more

    Declaration

    Swift

    public class DateItem : RVS_CalendarInputDateItemProtocol

Public Individual Day Button Class

  • Each day is represented by a button. This allows us to associate a DateItem with the button, and customize its display

    See more

    Declaration

    Swift

    public class DayButton : UIButton