Skip to main content
Filter by
Sorted by
Tagged with
87 votes
28 answers
109k views

I'm new to SwiftUI and iOS, and I'm trying to create an input field that will only accept numbers. TextField("Total number of people", text: $numOfPeople) The TextField currently allows alphabetic ...
Lupyana Mbembati's user avatar
22 votes
8 answers
27k views

I have a TextField in SwiftUI. When I apply padding to it as TextField(text, text: $value) .padding() the padding is outside of the tap area of the TextField, i.e. tapping on the padding does not ...
Vivek Roy's user avatar
  • 370
14 votes
4 answers
20k views

How is email validation done with swiftUI? TextField("Please enter your e-mail", text: self.$email) .modifier(ClearButton(text: $email)) .font(.headline) .padding(10) ....
user12723399's user avatar
10 votes
2 answers
1k views

I am playing around with SwiftUI, and am currently building a Form using a Picker. import SwiftUI struct ContentView: View { private let names = ["Bill", "Peter", "Johan", "Kevin"] @State ...
Kevin Renskers's user avatar
9 votes
1 answer
7k views

I want pass data on dismissing of presentViewController to previous screen. Here I would like to use block to pass data to previous screen as UIKitApp. But I'm not getting idea to pass data. What are ...
Jessy's user avatar
  • 167
9 votes
0 answers
403 views

I am having a problem on a simple Form{}. Automatic Keyboard Avoidance is not working. Below is a small form with a TextEditor(). When run, the keyboard sits on top the input field, requiring the user ...
Kent's user avatar
  • 1,374
8 votes
2 answers
5k views

Goals: Create a row/cell with buttons Embed row/cell in a Form What I did: I created a cell, with buttons. struct PointTypeButtons : View { var body: some View { VStack { ...
Mane Manero's user avatar
  • 3,908
8 votes
3 answers
3k views

I want to use the Material Design text field component in SwiftUI. There is a Material Design Text Field Component written for UIKit but not one for SwiftUI. Is it possible to use this Material Design ...
David's user avatar
  • 91
7 votes
2 answers
4k views

Currently I've a picker included in a Section included in a Form what I'm trying to reach is to align the selected value of the picker to the leading in both iOS 13 and 14, I've tried many solutions ...
Hesham Ali Kamal's user avatar
6 votes
5 answers
7k views

I'm trying to get a circle on top with the form content down below, right above my TabBar. I can somewhat force this by using .frame() but I'm not a big fan of that. It seems like there should be a ...
Joe Scotto's user avatar
  • 11.1k
6 votes
2 answers
10k views

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 ...
Jacob Miller's user avatar
6 votes
3 answers
3k views

I'm getting some odd animation behaviour with DatePickers in a SwiftUI form. A picture is worth a thousand words, so I'm sure a video is worth a million words: https://i.sstatic.net/bNrTK.jpg I'm ...
Sam's user avatar
  • 7,138
6 votes
1 answer
8k views

I am having trouble debugging an issue with input from textfields. Information: -MacOs Monterey Version 12.0 Beta 21A5284e -Xcode 13.0 beta 3 13A5192j -Physical phone IOS 15.0 19A297e Issue ...
Inb4cookies's user avatar
6 votes
2 answers
3k views

How can I put the image in the Form of swiftUI in order to have the same effect like the picture attached? I have try with this code, but not working: struct UserDetails: View { @ObservedObject ...
Damiano Miazzi's user avatar
6 votes
1 answer
960 views

Is it not meant to be possible to control the animations that take place inside of a Form view? I have here a playground that demonstrates the issue, along with a gif of what happens. As you can see, ...
bkocik's user avatar
  • 424
6 votes
2 answers
2k views

I have a SwiftUI Form with a Section that contains a DatePicker. The DatePicker is set to have a datePickerStyle of CompactDatePickerStyle(), by default, since it's in a Form. When tapping on the ...
Nick Kohrn's user avatar
  • 6,099
6 votes
1 answer
6k views

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 ...
amodrono's user avatar
  • 2,038
6 votes
0 answers
553 views

Hi there I have a tricky problem to solve with SwiftUI in Xcode 12.4 (iOS 14): given I have a Form with numerous sections and TextEditors, this form having a .toolbar modifier (bottom bar) with some ...
pprochazka72's user avatar
6 votes
1 answer
654 views

I am facing some weird glitches in my Form implementation. I am not sure whether this is some implementation error or a bug in SwiftUI itself. So basically what I want to do is the typical "ToDo/...
grahan's user avatar
  • 2,438
5 votes
4 answers
3k views

I use a form with a picker, and everything works fine (I am able to select an element from the picker), but I cannot deselect it. Does there exist a way to deselect an item from the picker? Thank you! ...
Johnas's user avatar
  • 336
5 votes
1 answer
3k views

I am trying to changing the black area of a section inside of a form using SwiftUI. Since Swift 2.0 in iOS 14, a form shows these with a of padding, but using background and foreground for the colors, ...
jwknz's user avatar
  • 6,824
5 votes
2 answers
2k views

How to remove the left and right Padding of a Form in SwiftUI? Every View I create has padding in the leading and trailing. Here is my code init() { UITableView.appearance()....
Azim Shaikh's user avatar
5 votes
2 answers
1k views

Trying to have a Form with multiple sections and each Section with it's own EditButton. How to trigger a Section into "edit mode" without triggering all sections in the Form, as seen in the ...
Noob's user avatar
  • 337
4 votes
1 answer
3k views

I want to create a view that has a form with a button below it. If I include a form and a button, the button goes to the bottom of the screen. Without Form Element With Form Element Is this just a ...
Cameron Henige's user avatar
4 votes
1 answer
1k views

I'm not able to change the background color of a Form in SwiftUI for iOS < 16. It always takes default form backgroundcolor depending on which color scheme is selected in the iPhone settings. All ...
floro's user avatar
  • 41
4 votes
0 answers
870 views

I am trying to show and hide a picker view with an animation. The code for this is pretty simple and although the code works for other views, I can't get it to work with a picker view. Hiding the ...
Maurice's user avatar
  • 286
3 votes
1 answer
6k views

I am developing a certain application where it requires a user to fill a form. a form is not a problem actually but problem is when i want more than just one form dynamically. The number of forms (of ...
timtimer's user avatar
3 votes
1 answer
3k views

I have a form on a SwiftUI NavigationView. The form has no special elements, only the standard ones: TextField, DatePicker, and some Buttons I would like to scroll programmatically to a specific ...
memical's user avatar
  • 2,561
3 votes
2 answers
333 views

When I present a sheet with SwiftUI, everything gets bolded. If I swipe a bit, the bold goes away. Example: .navigationBarItems(leading: Button(action:{ self.isSheetPresented.toggle() }) ...
alpennec's user avatar
  • 2,204
3 votes
1 answer
1k views

How can I fix the reason why the warning appears? struct ContentView: View { @State private var selectedDate: Date = Date() var body: some View { Form { DatePicker("...
Isaak's user avatar
  • 1,379
3 votes
2 answers
4k views

I am using a Form in SwiftUI based on a tutorial from YouTube, and I have placed some components inside it. However, when I tap the button, it doesn't show the tap animation (For example, when I tap a ...
NoobOfCpp's user avatar
3 votes
1 answer
68 views

This is my code: Form { Section {} // regular section no background Section { // <--- want this section to have a background color Text("Hello") } .background(Gradient(...
Yuda's user avatar
  • 45
3 votes
2 answers
1k views

I have an edit view that is presented by a NavigationLink. It takes a recipe, which is held in a manager that has an array of them. App Code (copy pasta should run): import SwiftUI @main struct ...
raphael's user avatar
  • 447
3 votes
2 answers
1k views

Due to the limitations of SwiftUI, I usually need to jump back into to UIKit and take advantage of UIKit components. This is all good, but I'm finding that I usually need to keep creating separate ...
LondonGuy's user avatar
  • 11.2k
3 votes
2 answers
5k views

I changed the y offset of a list, and now it's being clipped. I am trying to make it so that when you scroll, you can partially see the text underneath the Title and buttons at the top of the view. In ...
Mikael Weiss's user avatar
3 votes
1 answer
2k views

I would like a single item inside SwiftUI Form to run from side to side, without having Form's default margins. Unfortunately, whatever I do (like ading a wider .frame, negative horizontal padding, or ...
Tomáš Kafka's user avatar
3 votes
0 answers
330 views

How can I style a picker to make it look like in form, but without it being nested in it? In form picker looks like a navigation link which takes you to a separate screen where you can pick one option....
Ilyat's user avatar
  • 31
2 votes
1 answer
428 views

The default styling of the Form view in SwiftUI is a plain styled table view (when running in an iOS context on iPhone or iPad). Is it possible to get a rounded grouped style table view, similar to ...
Jasarien's user avatar
  • 58.6k
2 votes
1 answer
732 views

I'm building a trip planning app that lets the user select a city from a local json file using a Picker. The json file has 115K items and the UI freezes if I try to filter through this many items. Any ...
Booysenberry's user avatar
2 votes
3 answers
7k views

Hi i need help with making lazy property. I have this code: lazy var dateFormat: DateFormatter = { let formatter = DateFormatter() formatter.locale = NSLocale.current formatter....
Johanna's user avatar
  • 189
2 votes
1 answer
402 views

My SwiftUI segmented control picker uses plain Int ".tag(1)" etc values for its selection. CoreData only has Int16, Int32 & Int64 options to choose from, and with any of those options it ...
My4Paws's user avatar
  • 51
2 votes
1 answer
473 views

New to SwiftUI. I have a simple form with two Section(). In one of the section, I have put BarChartView() from SwiftUICharts() as shown below. The Bar chart does not fit in the section, needed help ...
learner's user avatar
  • 505
2 votes
1 answer
925 views

How can I reduce the spacing between Sections on a form for the following view? var body: some View { Form { Section { TextField("Name", ...
Faaiez Sallie's user avatar
2 votes
1 answer
3k views

I have three files: AddAssignment, ViewAssignment and Task. A button is clicked on AddAssignment.swift which successfully appends form data to an array inside of Task.swift. However, in a file ...
fesari's user avatar
  • 33
2 votes
3 answers
797 views

I have a TextField as search box.I want to make it autosearch i.e whenever i will enter a letter in the TextField, i should get the result without press a enter.Here is my code: TextField("Search&...
Santanu's user avatar
  • 347
2 votes
1 answer
971 views

in the UIKit I catch the button sender (which button is clicked) via code let colorVC = UIColorPickerViewController() colorVC.delegate = self clickedButton = sender present(...
KakhaBoo's user avatar
2 votes
1 answer
4k views

I'm making an app that uses a form in SwiftUI, and I'd like to edit the objects stored locally using said forms. In this case, I have a cake and a cookie to be stored in memory and I have two structs, ...
Valerio Ventucci's user avatar
2 votes
0 answers
684 views

I am trying to use DatePicker in my app. After I select a date, the displayed text changes randomly. it changes on random dates too. Sometimes it shows date like "Jan 26, 2021" and sometimes ...
ILuvProgramming's user avatar
2 votes
0 answers
682 views

I am looking to have multiple columns within a SwiftUI form section. I have seen other potential fixes and using .onTapGesture, but that seem's very 'hacky' and doesn't provide the same aesthetics a ...
benpomeroy9's user avatar
2 votes
0 answers
1k views

I am having a Form where an array is shown. Each row is a button where I want to open a fullscreenCover. The issue is, for the very first time a button is triggered and the sheet is shown, the object ...
stefOCDP's user avatar
  • 863