UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: Using a complex view as a picker

Forums > SwiftUI

Hi,

Is it possible to use a complex view to function as a picker? I have a list view with various filters and my styles already applied. I can certainly re-use the list item row sub-views I already have; but then I lose the toolbar and filtering functions.

I should note: I have already used a simple view to function as the template for each row in the list. This is not enough for my requirement due to filtering mechanics etc that use the toolbar.

I'm thinking perhaps the picker itself isn't the right tool for the job given my more complex need and I might be better with just a navigationLink to a child view? Has anyone done this?

3      

Nevermind; I tried and it works perfectly well if you just use a nav-link and pass a binding/state variable between the two. Much more flexible than a Picker

3      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.