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 create a func() to build OrderBy clauses #451

Open
appfabtech opened this issue Apr 13, 2022 · 1 comment
Open

How to create a func() to build OrderBy clauses #451

appfabtech opened this issue Apr 13, 2022 · 1 comment
Labels

Comments

@appfabtech
Copy link

appfabtech commented Apr 13, 2022

Hello, and thanks for the great library

I would like to create a function to avoid duplicate code in sort selection (having a table view with 4 different sort asc/desc
like
func buildSort(section: Section, sort: Sort, sortAscending: Bool) -> OrderBy

But I have issues on how to define in function declaration the -> OrderBy return parameter

Any help?

Thanks

@JohnEstropia
Copy link
Owner

OrderBy is a generic type, so you'll have to parameterize the object type:

func buildSort<T>(section: Section, sort: Sort, sortAscending: Bool) -> OrderBy<T>

(assuming Section and Sort there are your app's internal types)

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

No branches or pull requests

2 participants