Update onchange events

This commit is contained in:
Garth Vander Houwen 2024-10-06 08:50:12 -07:00
parent 3dcec505ff
commit d7e887dd63
17 changed files with 183 additions and 261 deletions

View file

@ -72,14 +72,14 @@ struct WaypointFormMapKit: View {
axis: .vertical
)
.foregroundColor(Color.gray)
.onChange(of: description, perform: { _ in
.onChange(of: description) {
var totalBytes = description.utf8.count
// Only mess with the value if it is too big
while totalBytes > 100 {
description = String(description.dropLast())
totalBytes = description.utf8.count
}
})
}
}
HStack {
Text("Icon")
@ -87,7 +87,7 @@ struct WaypointFormMapKit: View {
EmojiOnlyTextField(text: $icon, placeholder: "Select an emoji")
.font(.title)
.focused($iconIsFocused)
.onChange(of: icon) { value in
.onChange(of: icon) { _, value in
// If you have anything other than emojis in your string make it empty
if !value.onlyEmojis() {