nikstar/frommatchedgeometry
SwiftUI transition using `matchedGeometryEffect`.
Install
Recommended
Copy FromMatchedGeometry.swift to your project.
SPM
Add this repo using Swift Package Manager: <https://github.com/nikstar/FromMatchedGeometry>
Contrived exapmle
import FromMatchedGeometry
struct ContentView: View {
@State private var showInsertedView = false
@Namespace private var ns
var body: some View {
VStack {
SourceView()
.matchedGeometryEffect(id: 0, in: ns, isSource: true)
.onTapGesture { showInsertedView.toggle() }
if showInsertedView {
TargetView()
.transition(
.fromMatchedGeometry(id: 0, in: ns)
)
}
}
.animation(.bouncy, value: showInsertedView)
}
}Full example
Full example from demo video is available in FromMatchedGeometry.swift as a #Preview.
Package Metadata
Repository: nikstar/frommatchedgeometry
Default branch: main
README: README.md