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

Where to place code to 'show more options' #140

Open
netsmith opened this issue Feb 16, 2020 · 3 comments
Open

Where to place code to 'show more options' #140

netsmith opened this issue Feb 16, 2020 · 3 comments

Comments

@netsmith
Copy link

My twitter style popup displays a list of 10 items pulled from a 'paged' api. If one the 10 is not the right one then my app needs to show the next 10 items, this is done by querying the API again for page 2. Where is the best place to put this code?

@rodriar
Copy link

rodriar commented Feb 27, 2020

Cant you add a button in the bottom and change the data source?

@netsmith
Copy link
Author

netsmith commented Mar 2, 2020

@rodriar Not sure I understand. I tried adding a dummy item which was meant to close the menu, requery new data then open it up again, but that was really what my question was about. I didn't know where this code should live.

ie the action is this....

actionController.addAction(Action(ActionData(title: "None of the above", subtitle: "", image: tempImg!, uid: "no-id"), style: .default, handler: { action in
- not sure what to write here, to either update the menu with new options, or close the menu requery and then open again
}))

@rodriar
Copy link

rodriar commented Mar 2, 2020

Hey, you cant update the actioncontroller. Use the handler to fetch your data and create a new action controller with the new data and show it

actionController.addAction(Action(ActionData(title: "None of the above", subtitle: "", image: tempImg!, uid: "no-id"), style: .default, handler: { [weak self] action in
   let data = self?.fetchData()
   let actionController2 = ActionController()
   for item in data ?? [] {
      actionControlelr.add(Action(<something with item>))
   }
}))

Please keep this kind of questions for Stack overflow.
Cheers!

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