And then instead of always casting to AnyView, use a more generic any View parameter for the assertSnapshots function and then allow it to dynamically call the appropriate function based on the classes implementation type?
Happy to help further with an implementation but I think this would be a great addition!
Context 🕵️♀️
As per Apple's documentation - https://developer.apple.com/documentation/xcode/previewing-your-apps-interface-in-xcode
#Preview
supports other forms of views such as UIViewController, NSView, UIView. Right now, unless you exclude those the generated tests from the plugin won't compile.What 🌱
It would be amazing if we can add support for more view types other than just SwiftUI views.
Proposal 🎉
In the PreviewLoader, it assumes that it's a SwiftUI view and always wraps it in
AnyView
I wonder if we could add another function
assertSnapshots
to the stencil that takes in the other view types like:And then instead of always casting to
AnyView
, use a more genericany View
parameter for theassertSnapshots
function and then allow it to dynamically call the appropriate function based on the classes implementation type?Happy to help further with an implementation but I think this would be a great addition!