swiftui-form

Text in SwiftUI Form not wrapping after being changed

南笙酒味 提交于 2021-02-08 06:42:02
问题 I need to display some text in a SwiftUI Form that will change depending on the current state. However, if the "new" text is longer than the original string displayed when the form first appeared, it won't wrap correctly. In the example below, turning the toggle on changes the text being displayed, but it gets truncated instead of wrapping struct ContentView: View { @State var showLongString = false var body: some View { Form { Section { Text(showLongString ? "This is a string that is too

Text in SwiftUI Form not wrapping after being changed

放肆的年华 提交于 2021-02-08 06:40:54
问题 I need to display some text in a SwiftUI Form that will change depending on the current state. However, if the "new" text is longer than the original string displayed when the form first appeared, it won't wrap correctly. In the example below, turning the toggle on changes the text being displayed, but it gets truncated instead of wrapping struct ContentView: View { @State var showLongString = false var body: some View { Form { Section { Text(showLongString ? "This is a string that is too

Text in SwiftUI Form not wrapping after being changed

流过昼夜 提交于 2021-02-08 06:40:12
问题 I need to display some text in a SwiftUI Form that will change depending on the current state. However, if the "new" text is longer than the original string displayed when the form first appeared, it won't wrap correctly. In the example below, turning the toggle on changes the text being displayed, but it gets truncated instead of wrapping struct ContentView: View { @State var showLongString = false var body: some View { Form { Section { Text(showLongString ? "This is a string that is too

Disable Scrolling in SwiftUI List/Form

蓝咒 提交于 2020-08-07 09:46:17
问题 Lately, I have been working on creating a complex view that allows me to use a Picker below a Form. In every case, the Form will only have two options, thus not enough data to scroll downwards for more data. Being able to scroll this form but not Picker below makes the view feel bad. I can't place the picker inside of the form or else SwiftUI changes the styling on the Picker. And I can't find anywhere whether it is possible to disable scrolling on a List/Form without using: .disable

Disable Scrolling in SwiftUI List/Form

瘦欲@ 提交于 2020-08-07 09:42:24
问题 Lately, I have been working on creating a complex view that allows me to use a Picker below a Form. In every case, the Form will only have two options, thus not enough data to scroll downwards for more data. Being able to scroll this form but not Picker below makes the view feel bad. I can't place the picker inside of the form or else SwiftUI changes the styling on the Picker. And I can't find anywhere whether it is possible to disable scrolling on a List/Form without using: .disable

Reduce Form spacing between sections SwiftUI

坚强是说给别人听的谎言 提交于 2020-06-28 03:43:21
问题 I'm trying to make a notes app with SwiftUI and I'd like to show the notes similar to the Apollo Reddit app does. The way it shows the post isn't anything special, it just shows the posts using an interface similar to a list with GroupedListStyle() , but with less spacing between sections. I've tried a lot of tricks to reduce this spacing, but none of them seems to work. TL;DR I've got this : And I want this : Any help is appreciated. Thanks in advance! Here's my code : import SwiftUI struct

Swift UI How to create TextField that accepts numbers only

 ̄綄美尐妖づ 提交于 2020-05-11 04:37:33
问题 Im new to swiftUI and iOs, im trying to create an input field that will only accept numbers TextField("Total number of people", text: $numOfPeople) the TextField also allows alphabetic characters, how do I limit user to input only numbers? 回答1: You can set the type of keyboard on the TextField which will limit what people can type on. TextField("Total number of people", text: $numOfPeople) .keyboardType(.numberPad) Apple's documentation can be found here, and you can see a list of all