I want to update and use container members in picker , textfield and get price function.
struct PropertyContainer: Equatable {
static func == (lhs: PropertyContainer, rhs: PropertyContainer) -> Bool {
return lhs.fromQty == rhs.fromQty && lhs.fromCurrency == rhs.fromCurrency && lhs.toCurrency == rhs.toCurrency && lhs.toQty == rhs.toQty
}
@State var toQty: Double = 1.0
@State var toCurrency: String = "ETH"
@State var fromQty: Double = 1.0
@State var fromCurrency: String = "BTC"
}
struct ContentView: View {
@State private var propertyContainer = PropertyContainer()
using memebers of container in text field and picker so I need updates for getprice func.
.task(id: propertyContainer) {
do {
price = try await listMaker.getPrice(fromCurrency: propertyContainer.fromCurrency, fromQty: propertyContainer.fromQty, toCurrency: propertyContainer.toCurrency, toQty: propertyContainer.toQty, type: "Fixed")
print(propertyContainer.fromCurrency)
} catch {
print("Error")
}
}