I am new to Apple visionOS and am experiencing issue with displaying the full view of a webpage using webview for the top window in a VStack. The second webview is showing the full view of youtube website, however, the first webview is unable to show the full view of the same site. (Note: I have already scroll to the top for the first view but still does not see the Youtube logo and search bar)
Following is the code snippet for webview method
struct WebView: UIViewRepresentable {
var url: URL
func makeUIView(context: Context) -> WKWebView {
return WKWebView()
}
func updateUIView(_ uiView: WKWebView, context: Context) {
let request = URLRequest(url:url)
uiView.load(request)
}
}
Following is the code snippet in the main class file where I have attempted to resize the WindowGroup and set certain size for the View but it does not help.
WindowGroup {
ContentView()
.frame(minWidth: 2500, maxWidth: 2500, minHeight: 2500, maxHeight: 2500)
}
.windowResizability(.contentSize)
Following is the code for my VStack
VStack(spacing: 40) {
WebView(url: URL(string: "https://www.youtube.com/watch?v=y4nPSAaX14s")!).frame(width: 1000, height:800, alignment: .topLeading)
WebView(url: URL(string: "https://www.youtube.com/watch?v=NRVzPXtsFnQ")!).frame(width: 1000, height:800, alignment: .topLeading)
}
I have also attempted to try out the following Apple documentation:
https://developer.apple.com/documentation/visionos/positioning-and-sizing-windows
for resizing WindowGroup/View but still unable to show the Youtube logo and search bar for the top webview. I would greatly appreciate any help/sharing of knowledge if you have attempted the following before, thank you.