Post

Replies

Boosts

Views

Activity

onOpenURL not called for single-window Mac OS application
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!
1
0
466
Apr ’24
Background image scales incorrectly when ignoring safe area
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:
6
0
2.7k
Nov ’22