Questions tagged [textfieldstyle]

5 questions
2
votes
1 answer

Type mismatch between SwiftUI textFieldStyle modifiers RoundedBorderTextFieldStyle and PlainTextFieldStyle

I'm attempting to change the .textFieldStyle modifier for a TextField based upon whether my View is editing. I declare var isEditing: Bool, set this in the parent View and check against this in the body. My code: TextField("Type a Name", text:…
andrewbuilder
  • 3,629
  • 2
  • 24
  • 46
1
vote
1 answer

SwiftUI custom TextField with focus ring on macOS

I want to have my custom TextField style on macOS, that also has the focus ring however i am running into 2 issues, depending if i use .textFieldStyle(.roundedBorder) or .textFieldStyle(.plain) struct FTextFieldStyle: TextFieldStyle { func…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
0
votes
1 answer

How to detect that a TextField is focused when implementing custom TextFieldStyle in SwiftUI

I am implementing a custom TextFieldStyle like follow: struct CustomTextFieldStyle: TextFieldStyle { func _body(configuration: TextField) -> some View { configuration .foregroundColor(Color.black) } } However, I would…
Van Du Tran
  • 6,736
  • 11
  • 45
  • 55
0
votes
0 answers

Switch TextFieldStyle between OS

Say I have 2 TextFieldStyles like below where one of them should run with iOS 15+ if available. struct TF1: TextFieldStyle { init() func _body(configuration: TextField) -> some View {} } @available(iOS 15.0, *) struct TF2:…
oaranger
  • 169
  • 1
  • 11
0
votes
2 answers

How to retain text in textfields in flutter?

If there are multiple textfields in a screen in flutter which are edited to suitable text and from that screen when the user moves to other screen and comes back to the same screen where the text fields are. How should I make sure that those…
user13410550