I'm a little embarrassed to admit, but I had been blissfully unaware that View extensions are type erasing.
That means if you have an extension for using your ViewModifier in a more ergonomic way, it'll be erased to AnyView unless you explicitly mark it as @inlinable.
https://gist.github.com/phillipcaudell/df04ebf01e9579a308e3534ac829a540
Edit: Perhaps this is just a quirk of Xcode Previews: https://mastodon.notsobig.co/@phill/111051676536041177
@mattiem yes quite surprising! Presumably AnyView is introduced by the runtime?
I thought it made sense, but now I’m not sure it does. 😅
@phill I just don’t get it…
@mattiem It looks like it might be a quirk of Xcode Previews, actually https://mastodon.notsobig.co/@phill/111051676536041177
@phill since the modifier returns ‘some View’ the type information should be preserved.
@jasonhowlin indeed an opaque type should preserve type information, but it appears Xcode Previews for whatever reason discards it. 🤷♂️
@phill what if your return ModifiedContent instead?
@phill this is extremely surprising. Where is the AnyView even coming from!?