Card

class Card : NSObject

This is an abstract class upon which to build concrete card implementations.

  • A reference to the browser interface.

    @discussion Use this, for example, to make any changes to the top or bottom bars, add, update, or remove cards when a user interacts with a card instance.

    @seealso BTNBrowserInterface

    Declaration

    Swift

    weak var browser: (any BTNBrowserInterface)? { get }
  • The view instance currently associated with this card.

    @discussion Returns a non-nil value when a card instance has an associated view representing it. Use this to make any updates to your view, for example, when a user intracts with the view.

    Declaration

    Swift

    weak var view: UIView? { get }
  • The call to action object to be displayed when the card is “active”.

    Declaration

    Swift

    var cardCTA: CardCallToAction { get }
  • key

    An object that implements the isEqual: method of the NSObject protocol. This can be used to identify a card, and is meant to be unique.

    Declaration

    Swift

    var key: any NSObjectProtocol { get set }
  • Designated initializer for concrete subclass usage.

    Declaration

    Swift

    init(callToAction cardCTA: CardCallToAction)

    Parameters

    cardCTA

    The call to action object to be displayed when the card is on the top of the list.

    Return Value

    returns an instance of a card with a cardCta, or nil if passed nil.

  • Called when a card instance needs a view for displaying on screen. Subclasses must override this method and return a new view instance. @seealso -prepareView:

    Declaration

    Swift

    class func createView() -> UIView
  • Called just before the card’s view is displayed on screen. @discussion Subclasses must override this method to prepare the passed card view for display. The passed view will be an instance of the view returned from +createView @seealso +createView

    Declaration

    Swift

    func prepareView(_ cardView: UIView)