A SwiftUI proof-of-concept, and some sleight-of-hand, which adds rain to a view’s background.

“Ima use this in my app…”

Introducing Metal to SwiftUI workflow requires the same level of care and attention you’d give to adopting a rescue hyena. In many ways it’s an architectural decision. Have fun, but proceed with caution. ☺️

“This approach could be more efficient!”

Absolutely it can! In multiple ways. This is a proof of concept I put together over a couple of lunches during WWDC 2022. There’s plenty of room for improvement and I have a short attention span. Run wild and make it better. Or stare in wonder at the waste of a perfectly good GPU. ?

I’d love to hear from you

You can reach me through Twitter or LinkedIn.

Special Thanks

This example is a blend of ideas, tutorials, and code samples shared by these fine folks: Bartosz Ciechanowski | Martijn Steinrucken | Warren Moore

Photo by Thomas Lardeau


View Github