PrimerSelectCountryScope manages the country picker UI, exposed via PrimerCardFormScope.selectCountry. Use it to customize the country selection experience.
Declaration
Properties
| Property | Type | Description |
|---|---|---|
state | AsyncStream<PrimerSelectCountryState> | Stream of country picker state changes |
Customization
| Property | Type | Description |
|---|---|---|
screen | ((PrimerSelectCountryScope) -> AnyView)? | Full screen replacement |
searchBar | ((String, (String) -> Void, String) -> AnyView)? | Custom search bar. Parameters: query, onQueryChange, placeholder |
countryItem | CountryItemComponent? | Custom country row. Signature: (PrimerCountry, @escaping () -> Void) -> any View |
Methods
| Method | Description |
|---|---|
onCountrySelected(countryCode:countryName:) | Select a country |
cancel() | Cancel the picker |
onSearch(query:) | Filter countries by search text |
Accessing the scope
The country picker scope is accessed throughPrimerCardFormScope.selectCountry:
PrimerSelectCountryState
| Property | Type | Description |
|---|---|---|
countries | [PrimerCountry] | All available countries |
filteredCountries | [PrimerCountry] | Countries matching search query |
searchQuery | String | Current search text |
isLoading | Bool | Loading state |
selectedCountry | PrimerCountry? | Currently selected country |
PrimerCountry
See also
PrimerCardFormScope
Parent scope for the country picker