NamespaceWrapper
This gist allows you tu use matchedGeometryEffect
in SwiftUI 1, with an iOS 13 deployment target. iOS 13 users will get a fade animation, while iOS 14 users can get a beautiful matched geometry effect.
Instead of making a @Namespace
, just use the .namespaced()
modifier in your common view, and instead of .matchedGeometryEffect
, use .namespacedMatchedGeometryEffect
. All the namespace handling is done in .namespaced()
, so you don't pass a Namespace.ID
to your effect modifier.
The only missing property is the properties
argument. It can be added pretty easily, by using its rawValue
as argument (because its type is iOS 14-only).
Nice job, thanks for sharing this!