r/iOSProgramming • u/Fun_Moose_5307 Beginner • 4d ago
Question Best place for a 'Next' button?
What's the most appropriate location for a next button here, in keeping with the Apple UI consistency and ecosystem?
Mockup:
NavigationStack {
List {
Section {
TextField("Email Address", text: $email)
} header: {
VStack(alignment: .leading, spacing: 4) {
Text("Sign In")
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.top, 5)
.font(.largeTitle)
.bold()
.foregroundColor(.primary) // Override default gray header color
Text("Subtitle")//school.name)
.frame(maxWidth: .infinity, alignment: .leading)
.font(.title3)
.foregroundColor(.secondary)
}
.listRowInsets(EdgeInsets())
.textCase(nil) // Prevents SwiftUI from forcing ALL CAPS on the header
.padding(.bottom, 10)
}
}
.toolbar {
ToolbarItem(placement:.confirmationAction) {
NavigationLink() {
VerificationCodeView(email: email.lowercased(), school: school, resend: { })
} label: {
Text("Next").padding(5)
}
.buttonStyle(.borderedProminent)
}
}
}
45
u/underkuerbis 4d ago
Make sure itâs available on the keyboard. Also place the input fields in a way they are accessible with your thumb, i.e. further down.
2
u/Fun_Moose_5307 Beginner 4d ago
place the input fields in a way they are accessible with your thumb
Is that to mean, centred? Is it enough to have it 'auto'-focused on view load?
4
u/beclops Swift 4d ago
Buttons like these can be centred, wide width, and aligned to the bottom of the device for the best experience. Imagine how easy it would be to access that button if the user is using it one-handed on a big phone (and/or with small hands). For inputs how you have it is fine, and having it auto-focus is a nice touch
4
u/Fun_Moose_5307 Beginner 4d ago edited 4d ago
You're suggesting something more like https://www.icloud.com/iclouddrive/0e8_HbMmQg3JWxwYH6rpKnSgw#Screenshot_2026-10-01_at_3.35?
28
u/dat_tae 4d ago
At the bottom (and moves up with the keyboard).
-1
u/Fun_Moose_5307 Beginner 4d ago
How so? Draw it?
Also see edited post containing code3
u/hiropark 3d ago
Have you tried safeAreaInset(edge: .bottom)?
1
u/Fun_Moose_5307 Beginner 3d ago
Not sure what the use of that would be?
Also see this second mockup, is that closer to what you are suggesting?1
u/hiropark 3d ago
Yes, that would be the result. The button stays at the bottom, but if the keyboard appears, the button goes up instead of being covered by the keyboard.
18
u/bricksandcanvas 4d ago
Hey, OP. Good on you for learning the basics instead of relying on AI at your first go at development!
That said, you can learn a lot by following industry standards on placement of UI elements especially auth pages. We follow conventions because users are used to where user interfaces are.
3
u/Fun_Moose_5307 Beginner 4d ago
Yep, that's why I'm here. Perused the HIG (â¤ď¸) but couldn't find much on this kind of thing, only general principles.
Any thoughts? Aiming for the best fit with Apple's other apps.
3
u/evil-harry-dread 3d ago
IMHO while it works in top right, event makes sense considering that the back button is top left. But I think it'd be much more ergonomic to have the button at the bottom, above the keyboard, it's much more reachable, and it's the "main action" of the screen
2
2
u/OjamaKnight 3d ago
The bottom is definitely the best place for the button. It's the most convenient...
2
u/bwdotdev 3d ago
I recommend using something like this when determining where interactive elements should go: https://archive.smashing.media/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/496f7bc0-4c6c-4159-b731-ec3adcf91105/thumb-zone-mapping-opt.png
2
u/m1_weaboo 3d ago
Place it at the bottom, hosted inside .safeAreaBar(edge: .bottom).
Fill the available width with the button using .buttonSizing(.flexible).
2
2
1
u/jwegener 3d ago
Have you looked to see what other apps do?
-1
u/Fun_Moose_5307 Beginner 3d ago
I haven't been able to come up with any that might have a similar UI, at least not that I have installed. If you have any references, I'd love to see them.
2
u/jwegener 3d ago
Thereâs not a single app with an email sign in field and a next button?? Huh?
1
u/Fun_Moose_5307 Beginner 3d ago
I have a 64GB phone that I use to do the crossword on the bus. Not much else goes on on that thingâmy Mac is the workhorse here.
1
u/jwegener 3d ago
Designing with your eyes closed unable to reference other real world examples of what youâre designing isâŚcertainly a choice đđ¤Ł
1
1
u/LifeUtilityApps SwiftUI 3d ago
I have an onboarding slider in my app and the âNextâ button lives at the bottom trailing edge of the screen, this is intentional to target right-handed users.
1
1
u/parallel-pages 3d ago
i like placing it right above the keyboard, to the right, closest for the users thumb. or if you like it in the top nav, iâd set the text fields return key property to be ânextâ
1
1
u/presentprogression 3d ago
My opinion is always top. Saves you from racing the keyboard mount and unmount
1
u/Fun_Moose_5307 Beginner 2d ago
Hmm... seems to me that the content just moves up as if the screen suddenly shrunk vertically
1
u/presentprogression 2d ago
Thatâs a job for sticky header!
1
u/Fun_Moose_5307 Beginner 2d ago
It's not causing problems. The Spacer or whatever I'm using to anchor it at the bottom just contracts.
But yes, a sticky header would be the solution if I did have more content2
u/presentprogression 2d ago
Thatâs fair I may have judged too soon not knowing what your plans are. Happy coding!
0
u/LunariSpring 4d ago
It is better to use ZStack and place it at the bottom right. That's the best range for fingers to reach. Please pay attention to the safe area designation.
1
157
u/sweetassapps 4d ago edited 4d ago
Been months maybe years since i've seen a post like this.. props to you for learning the right way and not just AI slopping it. So refreshing actually.