Skip to content

Instantly share code, notes, and snippets.

@JustinFincher
Created July 28, 2023 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JustinFincher/a2d64d6d52535de7e3d841e7333230aa to your computer and use it in GitHub Desktop.
Save JustinFincher/a2d64d6d52535de7e3d841e7333230aa to your computer and use it in GitHub Desktop.
Recursive Outline Table
import SwiftUI
struct TestModel: Identifiable {
let id = UUID()
var children: [TestModel]? {
(0..<5).map { _ in
TestModel()
}
}
}
struct ContentView: View {
@State var root: TestModel = .init()
var body: some View {
Table(of: TestModel.self) {
TableColumn("ID", value: \.id.uuidString)
} rows: {
OutlineGroup(root, children: \.children) { row in
TableRow(row)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment