Hi,
I'm developing an app using SwiftUI for both iOS and Mac OS and use onOpenURL to handle external links. However, this doesn't seem to work after switching to a single window app on Mac OS.
This code works:
WindowGroup {
Text("Hi").onOpenURL { url in
print("Open URL", url)
}
}
But this doesn't:
Window("My App", id: "my_app") {
Text("Hi").onOpenURL { url in
print("Open URL", url)
}
}
Anyone knows a workaround? Thanks!
Post
Replies
Boosts
Views
Activity
In a SwiftUI project I try to display a background image with ignoring safe area insets (to make it go edge to edge). However, the background scales incorrectly and doesn't respect its aspect ratio.
Here is a small code example of the view structure that I'm using:
struct ContentView: View {
var body: some View {
ZStack {
Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.").padding()
}.frame(maxHeight: .infinity).background(Image("dots").resizable().ignoresSafeArea().scaledToFill())
}
}
And an example image for testing (when using this image you can clearly see the circles become more like ovals in the SwiftUI app):
Screenshot: