Hello, I have a question. I have a LookAroundPreview, that loads correctly a scene, and when I tap on it, it natively shows a view I can navigate in, and that I can close. All that is ok.
However, when I want to display that same LookAroundPreview in a fullScreenCover (because my app needs it for navigation purposes), it directly shows the navigatable View with the closeButton. That I don't want.
Is there an option to pass, that I missed? Is this a bug of the LookAroundPreview? Or is this wanted by Apple devs?
Thank you very much for your help,
Sincerely
import SwiftUI
struct ContentView: View {
@State private var displayFullScreen = false
//AppleLookAroundView is just a wrapper around native LookAroundPreview, that loads a NYC coordinate
var body: some View {
VStack {
AppleLookAroundView()
Spacer()
Button("Display fullScreen cover") {
displayFullScreen = true
}
Spacer()
}
.fullScreenCover(isPresented: $displayFullScreen) {
VStack {
AppleLookAroundView()
Text("⬆ It somehow detects it is in a fullScreenCover and unwantingly change its display")
}
}
}
}
import SwiftUI
import MapKit
import CoreLocation
struct AppleLookAroundView: View {
@State private var scene: MKLookAroundScene?
let coordinate = CLLocationCoordinate2D(latitude: 40.651238394229324, longitude: -73.96432239237737)
var body: some View {
LookAroundPreview(scene: $scene, allowsNavigation: true, badgePosition: .bottomTrailing)
.task {
do {
scene = try await fetchScene(for: coordinate)
} catch {
print("Couldn't fetch scene")
}
}
.frame(height: 300)
}
private func fetchScene(for coordinate: CLLocationCoordinate2D) async throws -> MKLookAroundScene? {
let lookAroundScene = MKLookAroundSceneRequest(coordinate: coordinate)
let scene = try await lookAroundScene.scene
return scene
}
}
![]("https://developer.apple.com/forums/content/attachment/a10a7701-dd8c-4d83-9a03-848cf0373417" "title=Capture d’écran 2024-04-24 à 12.56.46.png;width=898;height=1860")
``
![]("https://developer.apple.com/forums/content/attachment/d54f7fe1-aac8-4280-ab97-663f0bdd440f" "title=Capture d’écran 2024-04-24 à 12.56.34.png;width=924;height=1882")
`