Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to perform a selection #21

Closed
Insfgg99x opened this issue Jan 2, 2020 · 1 comment
Closed

How to perform a selection #21

Insfgg99x opened this issue Jan 2, 2020 · 1 comment

Comments

@Insfgg99x
Copy link

Insfgg99x commented Jan 2, 2020

Is there any interface like this:
didSelectItemAtIndexPath
Thanks!

@paololeonardi
Copy link
Owner

paololeonardi commented Jan 11, 2020

Hi @Insfgg99x

you could just attach a tap action to your grid views.

i.e.

WaterfallGrid(rectangles) { rectangle in
  RectangleView(rectangle: rectangle)
    .onTapGesture {
      print("Tap action")
    }
}

or

WaterfallGrid((0..<cards.count), id: \.self) { index in
  CardView(card: self.cards[index])
    .onTapGesture {
      print("Did select item at index \(index)")
    }
}

Hope this helps
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants