Reputation: 15
I have a TextField and Text next in HStack Sections. There is a large empty space between them and I can not figure out how to remove it.
VStack{
Section {
HStack {
TextField("Kohalik raha", text: $localMoney)
.multilineTextAlignment(.center)
Text("GEL")
.multilineTextAlignment(.leading)
}
}
Section {
Text("\(money, specifier: "%.2f") EUR")
}
Section {
HStack {
TextField("Kurss", text: $rate )
.multilineTextAlignment(.center)
Text("Kurss")
.multilineTextAlignment(.leading)
}
}
}
Upvotes: 1
Views: 1475
Reputation: 119184
Make the textField
have fixedSize
to bring them near in center:
HStack {
TextField("Kohalik raha", text: $localMoney)
.background(Color.blue)
.multilineTextAlignment(.center)
.fixedSize()
Text("GEL")
.multilineTextAlignment(.leading)
.background(Color.yellow)
}
I have added some colors to see better ;)
Upvotes: 3