Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
RevDoc prefersDefaultFocus
import SwiftUI
@available(iOS, unavailable)
@available(OSX, unavailable)
@available(tvOS 14.0, *)
@available(watchOS 6.0, *)
struct ContentView: View {
@Namespace var namespace
var body: some View {
VStack {
Button("Usually the default"){
print("Top button pressed")
Button("Prefers default"){
print("Bottom button pressed")
.prefersDefaultFocus(in: namespace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment