Originally created by @appfabtech on GitHub (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
Originally created by @appfabtech on GitHub (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
adam
added the question label 2025-12-29 15:30:41 +01:00
(assuming Section and Sort there are your app's internal types)
@JohnEstropia commented on GitHub (Sep 29, 2022):
`OrderBy` is a generic type, so you'll have to parameterize the object type:
```swift
func buildSort<T>(section: Section, sort: Sort, sortAscending: Bool) -> OrderBy<T>
```
(assuming `Section` and `Sort` there are your app's internal types)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @appfabtech on GitHub (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 commented on GitHub (Sep 29, 2022):
OrderByis a generic type, so you'll have to parameterize the object type:(assuming
SectionandSortthere are your app's internal types)