You should use the popover modifier.
This will show a sheet on iPhone and an overlaying view on iPad.
Here’s an example:
Button("Rules") {
presentPopup = true
}
.popover(isPresented: $presentPopup, arrowEdge: .bottom) {
Text("test")
.frame(width: 100, height: 100)
}
Check out the documentation for more information on usage.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: