Last active
October 5, 2023 20:24
-
-
Save beechtom/fdecee66e9a5574b47cbda84c79a0a6c to your computer and use it in GitHub Desktop.
SectionedQuery-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 | |
@Model | |
class Item { | |
@Attribute(.unique) var name: String | |
var kind: String | |
} | |
struct ContentView: View { | |
@SectionedQuery(\.kind) private var results: SectionedResults<String, Item> | |
var body: some View { | |
List(results) { section in | |
Section(section.id) { | |
ForEach(section) { item in | |
Text(item.name) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment