Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

init with bindings swiftui

struct AmountView : View {
    @Binding var amount: Double

    private var includeDecimal = false

    init(amount: Binding<Double>) {

        // self.$amount = amount // beta 3
        self._amount = amount // beta 4

        self.includeDecimal = round(self.amount)-self.amount > 0
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #init #bindings #swiftui
ADD COMMENT
Topic
Name
9+8 =