OPPaymentCardDetailsViewDelegate
@objc
public protocol OPPaymentCardDetailsViewDelegate : NSObjectProtocol
Defines the interface that should be implemented to receive updates from instances of
OPPaymentCardDetailsView. Each callback method is optional so you only need to implement the ones you need.
Important
There are two versions of each callback method. One version contains a reference to the view and can be used if you are implementing these callbacks in your UI layer. If implementing callbacks in a data layer it is recommended to implement the versions that do not contain a reference to a view.-
Called when any field changes.
Declaration
Swift
@objc optional func paymentCardDetailsViewDidChange(_ cardDetails: OPPaymentCardDetailsView)Parameters
cardDetailsThe card details view that changed
-
Called when any field changes.
Important
If using Swift,fieldStatescan be converted to a Swift Dictionary as follows:let state = fieldStates as! Dictionary<OPCardField, OPCardFieldStateProtocol>Declaration
Swift
@objc optional func paymentCardDetailsViewDidChange(with fieldStates: NSDictionary, isValid: Bool)Parameters
fieldStatesA dictionary representing the current state of the view. Keys are of type
OPCardFieldand values are of typeOPCardFieldStateProtocolisValidA convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValidproperty with a value oftrue) -
Called when editing begins in the view as a whole. This will always be followed by a
paymentCardDetailsViewFieldDidBeginEditing(...)callback.Declaration
Swift
@objc optional func paymentCardDetailsViewDidBeginEditing(_ cardDetails: OPPaymentCardDetailsView)Parameters
cardDetailsThe card details view that changed
-
Called when editing begins on the view as a whole. This will always be followed by a
paymentCardDetailsViewFieldDidBeginEditing(...)callback.Important
If using Swift,fieldStatescan be converted to a Swift Dictionary as follows:let state = fieldStates as! Dictionary<OPCardField, OPCardFieldStateProtocol>Declaration
Swift
@objc optional func paymentCardDetailsViewDidBeginEditing(with fieldStates: NSDictionary, isValid: Bool)Parameters
fieldStatesA dictionary representing the current state of the view. Keys are of type
OPCardFieldand values are of typeOPCardFieldStateProtocolisValidA convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValidproperty with a value oftrue) -
Called when editing ends on the view as a whole. This will always be preceded by a
paymentCardDetailsViewFieldDidEndEditing(...)callback.Declaration
Swift
@objc optional func paymentCardDetailsViewDidEndEditing(_ cardDetails: OPPaymentCardDetailsView)Parameters
cardDetailsThe card details view that changed
-
Called when editing ends on the view as a whole. This will always be preceded by a
paymentCardDetailsViewFieldDidEndEditing(...)callback.Important
If using Swift,fieldStatescan be converted to a Swift Dictionary as follows:let state = fieldStates as! Dictionary<OPCardField, OPCardFieldStateProtocol>Declaration
Swift
@objc optional func paymentCardDetailsViewDidEndEditing(with fieldStates: NSDictionary, isValid: Bool)Parameters
fieldStatesA dictionary representing the current state of the view. Keys are of type
OPCardFieldand values are of typeOPCardFieldStateProtocolisValidA convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValidproperty with a value oftrue -
Called when editing begins on a specific field
Declaration
Swift
@objc optional func paymentCardDetailsViewFieldDidBeginEditing(_ cardDetails: OPPaymentCardDetailsView, field: OPCardField)Parameters
cardDetailsThe card details view that changed
fieldThe field that is being edited
-
Called when editing begins on a specific field
Important
If using Swift,fieldStatescan be converted to a Swift Dictionary as follows:let state = fieldStates as! Dictionary<OPCardField, OPCardFieldStateProtocol>Declaration
Swift
@objc optional func paymentCardDetailsViewFieldDidBeginEditing(with fieldStates: NSDictionary, field: OPCardField, isValid: Bool)Parameters
fieldStatesA dictionary representing the current state of the view. Keys are of type
OPCardFieldand values are of typeOPCardFieldStateProtocolfieldThe field that is being edited
isValidA convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValidproperty with a value oftrue -
Called when editing ends for a specific field
Declaration
Swift
@objc optional func paymentCardDetailsViewFieldDidEndEditing(_ cardDetails: OPPaymentCardDetailsView, field: OPCardField)Parameters
cardDetailsThe card details view that changed
fieldThe field that is no longer being edited
-
Called when editing ends for a specific field
Important
If using Swift,fieldStatescan be converted to a Swift Dictionary as follows:let state = fieldStates as! Dictionary<OPCardField, OPCardFieldStateProtocol>Declaration
Swift
@objc optional func paymentCardDetailsViewFieldDidEndEditing(with fieldStates: NSDictionary, field: OPCardField, isValid: Bool)Parameters
fieldStatesA dictionary representing the current state of the view. Keys are of type
OPCardFieldand values are of typeOPCardFieldStateProtocolfieldThe field that is being edited
isValidA convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValidproperty with a value oftrue -
Called whenever the view’s
isValidproperty changesDeclaration
Swift
@objc optional func paymentCardDetailsViewIsValidChanged(_ cardDetails: OPPaymentCardDetailsView)Parameters
cardDetailsThe card details view that changed
-
Called whenever the view’s
isValidproperty changesImportant
If using Swift,fieldStatescan be converted to a Swift Dictionary as follows:let state = fieldStates as! Dictionary<OPCardField, OPCardFieldStateProtocol>Declaration
Swift
@objc optional func paymentCardDetailsViewIsValidChanged(with fieldStates: NSDictionary, isValid: Bool)Parameters
fieldStatesA dictionary representing the current state of the view. Keys are of type
OPCardFieldand values are of typeOPCardFieldStateProtocolisValidA convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValidproperty with a value oftrue