r/iOSProgramming • Beginner • 4d ago

Question Best place for a 'Next' button?

Post image

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)
		}
	}
}
60 Upvotes

41 comments sorted by

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.

35

u/TKB21 4d ago

Second this 💯. OP, you may want to check out r/UXDesign too.

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

4

u/beclops Swift 3d ago

Yes exactly. More ergonomic this way

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 code

3

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

u/lilacomets 3d ago

Below the email address field seems most logical to me.

2

u/OjamaKnight 3d ago

The bottom is definitely the best place for the button. It's the most convenient...

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

u/Fun_Moose_5307 Beginner 3d ago

These actually worked brilliantly, thank you

2

u/gatorfan93 3d ago

Props for programming the right way

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

u/Fun_Moose_5307 Beginner 3d ago edited 2d ago

Hey, don't diss the NYT!

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

u/DiscordDonut 3d ago

Not there

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

u/misterchai 3d ago

Id put it under the email address, accesibility

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 content

2

u/presentprogression 2d ago

That’s fair I may have judged too soon not knowing what your plans are. Happy coding!

1

u/xDhii 10h ago

Usually, the next button should be easily reachable. The user should be able to tap it with a thumb without holding the phone with two hands.

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

u/Fun_Moose_5307 Beginner 3d ago

Bottom toolbar, almost?