Skip to content

Commit e732139

Browse files
committed
Pass binding variable to command via the country selector view model
1 parent e29670e commit e732139

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Address Edit/CountrySelectorViewModel.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Combine
22
import SwiftUI
33
import Yosemite
4+
import struct SwiftUI.Binding
45
import protocol Storage.StorageManagerType
56

67
/// View Model for the `CountrySelector` view.
@@ -31,14 +32,8 @@ final class CountrySelectorViewModel: FilterListSelectorViewModelable, Observabl
3132
///
3233
private var subscriptions = Set<AnyCancellable>()
3334

34-
init(countries: [Country], selected: CurrentValueSubject<Country?, Never>) {
35-
self.command = CountrySelectorCommand(countries: countries, selected: selected.value)
36-
37-
/// Bind selected country to the provided selected subject
38-
///
39-
command.$selected.sink { country in
40-
selected.send(country)
41-
}.store(in: &subscriptions)
35+
init(countries: [Country], selected: Binding<Country?>) {
36+
self.command = CountrySelectorCommand(countries: countries, selected: selected)
4237
}
4338
}
4439

0 commit comments

Comments
 (0)