Skip to content

Instantly share code, notes, and snippets.

@beechtom
Last active October 5, 2023 05:52
Show Gist options
  • Save beechtom/5ee642b057e10574d417fc4904e99870 to your computer and use it in GitHub Desktop.
Save beechtom/5ee642b057e10574d417fc4904e99870 to your computer and use it in GitHub Desktop.
SectionedResults-03
import SwiftData
struct SectionedResults<SectionIdentifier, Result>: RandomAccessCollection
where SectionIdentifier: Hashable, Result: PersistentModel {
struct Section: RandomAccessCollection, Identifiable {
typealias Element = Result
typealias ID = SectionIdentifier
typealias Iterator = IndexingIterator<Self>
var id: ID
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment