SwiftCoding icon indicating copy to clipboard operation
SwiftCoding copied to clipboard

CurrencyField

Open telcosolutions opened this issue 3 years ago • 0 comments

Problem #3 There is a problem in format in the view. Try this: var body: some View {

	HStack{
		Spacer()

// CurrencyField("test", value: Binding( // get: {amount.map { NSDecimalNumber(decimal: $0) } // }, set: { number in amount = number?.decimalValue // }))

		Text("Hello World")
		Spacer()
			Button(action: {
				if amount == nil { amount = 0.0}
				amount = Decimal(1) + amount!
			}, label: {
				HStack {
					Text("EXec")
						.font(.system(size: 30))
				}
			})
		Spacer()
	}

}

The 2 fields are equal distance from the edge and each other. Then comment out the Text field and uncomment the CurrencyField. The 2 fields are on the edge of the view.

George

telcosolutions avatar Jan 06 '22 19:01 telcosolutions