another.im-ios/old/View/UIToolkit/Binding+Extensions.swift

13 lines
289 B
Swift
Raw Normal View History

2024-06-19 15:15:27 +00:00
import SwiftUI
extension Binding where Value == String {
func max(_ limit: Int) -> Self {
if wrappedValue.count > limit {
DispatchQueue.main.async {
wrappedValue = String(wrappedValue.dropLast())
}
}
return self
}
}