AzureCommunicationUI/AzureCommunicationUIDemoApp/Sources/Views/ViewModifier/TextFieldClearButton.swift (18 lines of code) (raw):

// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // import SwiftUI struct TextFieldClearButton: ViewModifier { @Binding var text: String func body(content: Content) -> some View { HStack { content if !text.isEmpty { Button( action: { self.text = "" }, label: { Image(systemName: "delete.left") .foregroundColor(Color(UIColor.opaqueSeparator)) } ).accessibilityIdentifier(AccessibilityId.clearTokenTextFieldAccessibilityID.rawValue) } } } }