0

I wanted to know, how the following interaction can be implemented with SwiftUI. I don't want to open the ImagePicker though.

I'm building an app to practice the Japanese alphabet and the user should be able to say which characters he wants to practice. The selection process should be similar to selection photos as shown in the image.

What's the best way to do something like this?

simibac
  • 7,672
  • 3
  • 36
  • 48

1 Answers1

2

If I were to implement this, I'd probably have an overlay view (above the collection view with thumbnails) that has a drag gesture recogniser. (You'd then need logic that can translate position on overlay to collection view cell index-path.)

This suggests that proper collection view behavior is not yet available in SwiftUI, so you'd have to wrap UICollectionView as indicated.

From my experience with SwiftUI so far, I think this isn't going to be easy because of the close interaction needed between collection view and overlay view. That's because interactive things requires to make bindings/observables, which I personally still find pretty cumbersome; probably (hopefully for large part) a matter of getting-used-to.

Because SwiftUI isn't complete yet and massively lacks documentation, I'd actually advise you to build this with the good old UIKit. Unless of course this for example is experimental to get experience with SwiftUI.

meaning-matters
  • 21,929
  • 10
  • 82
  • 142