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
cardDetails
The card details view that changed
-
Called when any field changes.
Important
If using Swift,fieldStates
can 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
fieldStates
A dictionary representing the current state of the view. Keys are of type
OPCardField
and values are of typeOPCardFieldStateProtocol
isValid
A convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValid
property 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
cardDetails
The 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,fieldStates
can 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
fieldStates
A dictionary representing the current state of the view. Keys are of type
OPCardField
and values are of typeOPCardFieldStateProtocol
isValid
A convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValid
property 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
cardDetails
The 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,fieldStates
can 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
fieldStates
A dictionary representing the current state of the view. Keys are of type
OPCardField
and values are of typeOPCardFieldStateProtocol
isValid
A convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValid
property with a value oftrue
-
Called when editing begins on a specific field
Declaration
Swift
@objc optional func paymentCardDetailsViewFieldDidBeginEditing(_ cardDetails: OPPaymentCardDetailsView, field: OPCardField)
Parameters
cardDetails
The card details view that changed
field
The field that is being edited
-
Called when editing begins on a specific field
Important
If using Swift,fieldStates
can 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
fieldStates
A dictionary representing the current state of the view. Keys are of type
OPCardField
and values are of typeOPCardFieldStateProtocol
field
The field that is being edited
isValid
A convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValid
property with a value oftrue
-
Called when editing ends for a specific field
Declaration
Swift
@objc optional func paymentCardDetailsViewFieldDidEndEditing(_ cardDetails: OPPaymentCardDetailsView, field: OPCardField)
Parameters
cardDetails
The card details view that changed
field
The field that is no longer being edited
-
Called when editing ends for a specific field
Important
If using Swift,fieldStates
can 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
fieldStates
A dictionary representing the current state of the view. Keys are of type
OPCardField
and values are of typeOPCardFieldStateProtocol
field
The field that is being edited
isValid
A convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValid
property with a value oftrue
-
Called whenever the view’s
isValid
property changesDeclaration
Swift
@objc optional func paymentCardDetailsViewIsValidChanged(_ cardDetails: OPPaymentCardDetailsView)
Parameters
cardDetails
The card details view that changed
-
Called whenever the view’s
isValid
property changesImportant
If using Swift,fieldStates
can 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
fieldStates
A dictionary representing the current state of the view. Keys are of type
OPCardField
and values are of typeOPCardFieldStateProtocol
isValid
A convenience parameter to quickly determine if the view is in a valid state (e.g. all fields in the dictionary have an
isValid
property with a value oftrue