Questions tagged [swiftui-text]

60 questions
1
vote
2 answers

change color of uitextfield not working in swiftui

I am trying to change color of textfield with below code but it is not working. It takes color as white if the it is light theme and for dark theme automatically takes black color. I want to keep it always black. var body: some View { …
ios developer
  • 3,363
  • 3
  • 51
  • 111
1
vote
2 answers

How can I show a fraction with SwiftUI

I am trying to represent a fraction with denominator larger than 9 in a SwiftUI Text. I can implement this using individual elements and applying offsets but that get's a bit messy as the fractions change dynamically. Is there a way to do this using…
alionthego
  • 8,508
  • 9
  • 52
  • 125
1
vote
2 answers

How to use bold and normal text in same line in SwiftUI

I want to use multiple text formats in one Text view in SwiftUI. this would look like this: i want to have multiple formats for text in the same text box at the same time even if it is really really really really really long text so it would need…
a1cd
  • 17,884
  • 4
  • 8
  • 28
1
vote
0 answers

SwiftUI: Text animation not working from the second line

I am trying to make sure I have a consistent animation throughout this dynamic Text view as I'm typing in the TextField. import SwiftUI struct ContentView: View { @ObservedObject var viewModel = ContentViewModel() var body: some View…
Miki
  • 329
  • 4
  • 10
1
vote
0 answers

SwiftUI TextField kerning/tracking?

I am very new to SwiftUI and I am trying to add kerning to TextField in SwiftUI and can't figure out how. Can anybody help, can't even figure out what to write more in this post.
1
vote
0 answers

SwiftUI - TextField currency input as user types

So I'm using a TextField with a formatter, the issue is unless the user hits return that value is not captured which is causing some distress for users, even though I have added a label stating they should hit return, but in fairness it doesn't seem…
SwiftUser
  • 555
  • 6
  • 17
1
vote
1 answer

Localizable.strings works for String, but not for Double and Integer 32

As a Swift newbie I am trying to localize a simple SwiftUI and Core Data project at Github: I have added the following en.lproj/Localizable.strings file to my project: "elo-rating %@" = "Elo rating: %@"; "avg-time %@" = "Average time:…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
1
vote
1 answer

How to have text fit within boundaries of circular shape/image SwiftUI

I can't seem to grasp how to make sure that my text overlays and fits within the circular image's boundaries. This is what I have so far. Circle() .frame(width: 100, height: 100) .overlay( Text("Reaaaallllllyyyyyy Looooooongggggg") …
Petesta
  • 1,623
  • 3
  • 19
  • 29
1
vote
1 answer

SwiftUI - inline style text background color that fits to the width of multi line text SwiftUI

I am trying to create a background text color that tracks to the width of each line of multi line text. See image below: I have only been able to get a basic box background color using .background(Color.black) it gives a background to the entire…
Soupnoodle
  • 11
  • 2
1
vote
1 answer

Detect when a user stopped / paused writing in TextField - SwiftUI

I want to get notified when the user is done writing text in a TextField in SwiftUI. The senario in as follows: -the user enters text in a TextField. -when the user wrote a string that is longer then 3 characters and paused or finished writing I…
TheMachineX
  • 179
  • 1
  • 11
0
votes
2 answers

How to apply the same font size to multiple Texts within an HStack and size the HStack to fit its parent?

I have an HStack with three Texts: HStack { Text("Hey") Text(".") Text("What's up?") } All I want is the HStack to fill the available space of its parent container under the constraint that all three Texts have the same font size in the…
Mischa
  • 15,816
  • 8
  • 59
  • 117
0
votes
0 answers

Picker Accesibility. SWIFT UI

I am trying disable dynamic text size from the accesibility system in a Menu picker but have yet to have any luck. I tried .font(.systemsize) dynamicTypeSize(...DynamicTypeSize.accessibility1), and .dynamicTypeSize(.medium) with no avail. Any ideas…
ZmcDee
  • 1
0
votes
1 answer

How can you add clickable text in a SwiftUI Text() View?

I've seen people using AttributedString and .link to link to something, but I need it to run a function, not open a browser link. I want something like this in SwiftUI, with wrapping, etc. Terms of service agreement (this image was made with HTML) I…
0
votes
0 answers

SwiftUI TextFields on vanilla brand new project giving errors [LayoutConstraints]. How to fix it?

I just created a vanilla brand new SwiftUI project with the most basic possible view for a textfields with not styling whatsoever: struct ContentView: View { @State private var email = "" @State private var password = "" var body:…
Pro Girl
  • 762
  • 7
  • 21
0
votes
1 answer

SwiftUI toggle Text selection with .enabled and .disabled

Enabling text selection statically works fine as in this answer How do I allow text selection on a Text label in SwiftUI? simply; Text("Selectable text") .textSelection(.enabled) Text("Non selectable text") .textSelection(.disabled) I…
kelalaka
  • 5,064
  • 5
  • 27
  • 44