Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change in Form UI in iOS 14 for SwiftUI

After building my SwiftUI for iOS 14 I've noticed that a lot of alignments were broken in forms.

Now each section seems to be in a rectangle with rounded corners and extra padding. It looks great on devices with large screens, but on smaller screens everything is cluttered and there is barely any space to display the content.

enter image description here

Looking around this seems to be a voluntary UI change from Apple, but I can't find a way to revert it since it doesn't work with my current layout.

Is this a known change in the default UI? Can I revert back to the way it was in iOS13 or do I have to rebuild everything on my own and not use a Form view?

like image 748
marcgg Avatar asked Oct 02 '20 09:10

marcgg


People also ask

How to create and use form in SwiftUI?

SwiftUI Form tutorial – how to create and use Form in SwiftUI. 1 Form with TextField. In order to create a basic form with text field, wrap your content view in NavigationView and then embed a Form within it: 2 Add Section and Toggle to the Form. 3 Add Picker to the Form. 4 Add Section with Stack and Text to the Form. 5 Add Button to the Form.

Are You updating your Swift books for SwiftUI?

Editor’s note: We are updating our Swift books for SwiftUI. If you purchase it now, you’ll receive the update for free when the book is officially updated. Founder of AppCoda. Author of multiple iOS programming books including Beginning iOS Programming with Swift and Mastering SwiftUI. iOS App Developer and Blogger.

How to create a label with placeholder in SwiftUI?

We set the label’s value to NAME and change its font type to headline. Like UIKit, the SwiftUI framework comes with a built-in text field component. To create a text field with a placeholder, you can write the code like this: To place the label above the text field, you can use a VStack to arrange both components.

Should I switch from Objective-C to Swift for UI development?

But just like the time when we switched from Objective-C to Swift, you’ll enjoy writing the UI code in the declarative syntax once you manage it. You’ll feel more natural to describe the app layout you want.


Video Answer


1 Answers

It's the new default style but you could change your Form to a List and apply the listStyle modifier in order to get the old look:

List {
    //...
}
.listStyle(GroupedListStyle())

Before:
enter image description here

After:
enter image description here

like image 160
finebel Avatar answered Oct 21 '22 08:10

finebel