Last active
October 5, 2023 07:44
-
-
Save beechtom/f555400cb8f257acc8c4ff7b151548db to your computer and use it in GitHub Desktop.
SectionedResults-06
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftData | |
struct SectionedResults<SectionIdentifier, Result>: RandomAccessCollection | |
where SectionIdentifier: Hashable, Result: PersistentModel { | |
typealias Element = Self.Section | |
typealias Index = Int | |
typealias Iterator = IndexingIterator<Self> | |
var elements: [Element] | |
var startIndex: Index = 0 | |
var endIndex: Index { elements.count } | |
subscript(position: Index) -> Element { | |
elements[position] | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment