Skip to content

Commit

Permalink
Add teardown logic to SwiftUI views
Browse files Browse the repository at this point in the history
  • Loading branch information
mbernson committed Jun 18, 2024
1 parent 5a2f9bd commit 603c6af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/MetalScope/PanoramaView/Panorama.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ public struct Panorama: UIViewRepresentable {
}
}

public static func dismantleUIView(_ panoramaView: PanoramaView, coordinator: Coordinator) {
panoramaView.isPlaying = false
panoramaView.scene = nil
panoramaView.sceneRendererDelegate = nil
}

public func makeCoordinator() -> Coordinator {
Coordinator()
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/MetalScope/StereoView/StereoPanorama.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public struct StereoPanorama: UIViewRepresentable {
}
}

public static func dismantleUIView(_ stereoView: StereoView, coordinator: Coordinator) {
stereoView.isPlaying = false
stereoView.scene = nil
stereoView.sceneRendererDelegate = nil
}

public func makeCoordinator() -> Coordinator {
Coordinator()
}
Expand Down

0 comments on commit 603c6af

Please sign in to comment.