Last active
October 5, 2023 19:33
-
-
Save beechtom/f1fcfc2247a795a003b7595e6ca333b5 to your computer and use it in GitHub Desktop.
SectionedQuery-02
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 | |
import SwiftUI | |
@propertyWrapper | |
struct SectionedQuery<SectionIdentifier, Result> | |
where SectionIdentifier: Hashable, Result: PersistentModel { | |
private let sectionIdentifier: KeyPath<Result, SectionIdentifier> | |
private var results: [Result] | |
var wrappedValue: SectionedResults<SectionIdentifier, Result> { | |
SectionedResults(sectionIdentifier: sectionIdentifier, | |
results: results) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment