Michael Long
Aug 17, 2022

--

Well, yeah. In order to show that view in a preview you'd need to pass in a constant which is, ah... let me see... oh, yeah. A constant. ;)

SelectionView(isSelected: .constant(true), title: .constant("Test"))

So yes, if you want to have a working version in Preview then you'd need to create a Preview wrapper.

By the way, passing the title as a binding is overkill. The component doesn't change the title, so a simple let value is sufficient.

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

No responses yet