hi,
in the app I am building, I display some info about a product. one is the price, a double. And the other is an int, the product code.
I have this code:
struct ContentView: View {
var body: some View {
VStack {
HStack {
Text("Product Name")
.font(.title)
Spacer()
Text("100")
}.padding(.leading).padding(.trailing).padding(.top)
Spacer()
productInfo(price: 1234567868, code: 23456789).padding(.leading).padding(.trailing).padding(.bottom)
}
.frame(width: 360, height: 100 )
.background(Color(UIColor.secondarySystemBackground))
.cornerRadius(25)
}
}
struct productInfo: View {
var price: Double
var code: Int
var body: some View {
VStack {
HStack {
Text("Product Price")
Spacer()
Text("$\(price, specifier: "%.2f")")
}
HStack {
Text("Product Code")
Spacer()
Text("\(code)")
}
}
// .frame(width: 250)
}
}
when I run that, this is what I get(copy pasted from simulator)
the product code: 23,456,789
and the price: $1,234,567,868.00
what can I do to remove those commas from the view?
thanks!