Mercurial > public > simoleon
view Simoleon/UI/ConversionTextfield.swift @ 170:f4e0c414cf6d
minor UI changes
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Thu, 23 Sep 2021 15:14:48 +0200 |
parents | 0c589138a6f3 |
children |
line wrap: on
line source
// // ConversionTextfield.swift // Simoleon // // Created by Dennis Concepción Martín on 29/8/21. // import SwiftUI struct ConversionTextfield: View { @Binding var amount: String @Binding var isEditing: Bool var body: some View { ZStack { TextField("Enter amount", text: $amount) { startedEditing in if startedEditing { withAnimation { isEditing = true } } } onCommit: { withAnimation { isEditing = false } } .keyboardType(.decimalPad) .font(Font.title.weight(.semibold)) .lineLimit(1) } } } struct ConversionTextfield_Previews: PreviewProvider { static var previews: some View { ConversionTextfield(amount: .constant("1000"), isEditing: .constant(false)) } }