-
-
Save sturdysturge/20496a89adf57c45f66eb1a72c23ea0a to your computer and use it in GitHub Desktop.
RevDoc prefersDefaultFocus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
.focusScope(namespace) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment