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).
I actually have a library β https://github.com/shaps80/SwiftUIBackports β that includes many full backports and will soon include support for this as well, as in the same feature will work in iOS 13 as well. Almost all backports work on the expected platforms as well (i.e. iOS, macOS, tvOS, watchOS)
Can I also suggest a couple small improvements regardless. You can drop the
AnyViewwhich is less performant and problematic at times with things like animation.Also in
NamespaceReaderyou havenamespace!β you could instead just set yourdefaultValuein your EnvironmentKey to a default instance and get rid of the potential crash π