another.im-ios/ConversationsClassic/UIToolkit/Binding+Extensions.swift
2024-08-11 13:09:29 +02:00

13 lines
289 B
Swift

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
}
}