Skip to content

Commit

Permalink
feat: add metadata and cardMetadata to ios docs (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcschy authored Jan 11, 2023
1 parent 19548d7 commit 2d94707
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/sdks/mobile/ios/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,25 @@ myTextField.subject.sink { completion in
...
}.store(in: &cancellables)
```

## Using Metadata for Event Values

Instead of subscribing to events, the same properties can be accessed at any time from the `metadata` property on all elements.

Additionally, the card related event [details](#elementeventdetail-types) can be accessed from the `cardMetadata` property only on [`CardNumberUITextField`](/docs/sdks/mobile/ios/types#cardnumberuitextfield).

The following are the available properties accessible from `metadata`.

| Property | Type | Description |
| ------------- |--------|------------------------------------------------------------------------------------------------------------|
| complete | _Bool_ | Whether the input `valid` and `maskSatisfied` properties are `true`. |
| valid | _Bool_ | Whether the input is `valid` according to `validation` for each element. |
| maskSatisfied | _Bool_ | Whether the input satisfies the `mask` length requirements. |

The following are the available properties accessible from `cardMetadata`.

| Property | Type | Description |
| --- | --- | --- |
| cardBrand | _String_ | [Card brand](/docs/sdks/mobile/ios/types#card-brands) name when a card number can be identified. |
| cardLast4 | _String_ | Last 4 digits of a card number when the input is considered `complete`. |
| cardBin | _String_ | First 6 digits of a card number when the input is considered `complete`. |
2 changes: 2 additions & 0 deletions docs/sdks/mobile/ios/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,5 @@ myTextElement.backgroundColor = UIColor( red: 240/255, green: 240/255, blue: 240
| setValue | A function that recieves an `ElementValueReference` parameter to set the value of the element. Note: `ElementValueReference` instances can only be retrieved from [proxy](/docs/sdks/mobile/ios/services#proxy) responses. |
| setValueRef | Binds the provided element instance as a value source for the calling element, keeping the value of the calling element in sync with any changes made to the provided element. This makes the caller element read-only. Any iOS element type can be provided as an instance into this function. |
| setConfig | A function that allows you to set a [mask](/docs/sdks/mobile/ios/options#mask) and [transform](/docs/sdks/mobile/ios/options#transform) on [TextElementUITextField's](/docs/sdks/mobile/ios/types#textelementuitextfield), and [associate a CardNumberUITextField to a CardVerificationCodeUITextField](/docs/sdks/mobile/ios/types#associating-a-cardnumberuitextfield). |
| metadata | An object that contains [metadata](/docs/sdks/mobile/ios/events#using-metadata-for-event-values) about the element state in regards to its value.
| cardMetadata | An object that contains metadata about the card number for the [`CardNumberUITextField`](/docs/sdks/mobile/ios/types#cardnumberuitextfield) element type only.

1 comment on commit 2d94707

@vercel
Copy link

@vercel vercel bot commented on 2d94707 Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.