I hadn't thought of that limitation when experimenting earlier. I tried using Group around subsets of TableColumns to keep the total below ten. The compiler didn't like the use of Group within the Table {} range. Even a small group would result in the same error message "The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions."
Post
Replies
Boosts
Views
Activity
Well that looks terrible.... if you see what I see after clicking submit which is a jumbled mess without breaks. How do I cleanly post code?
Xcode is Version 13.0 beta 4 (13A5201i).
OS is Monterey Version 12.0 Beta (21A5304g)
Sorry about the tags - they were auto populated and this is my first post so I was a little confused. Yes - SwitfUI.
I tried a simplistic side by side table approach - might work if I could figure out how to synchronize scrolling.
Here's the code... I'm sure there is a better way to post it but couldn't find that quickly in forum FAQs.
import SwiftUI
@available(macOS 12.0, *)
@main
struct TablePlayApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
import SwiftUI
@available(macOS 12.0, *)
struct ContentView: View {
@State private var data = MyData.viewData
var body: some View {
Table(data) {
TableColumn("One", value: .one)
TableColumn("Two", value: .two)
TableColumn("Three", value: .three)
TableColumn("Four", value: .four)
TableColumn("Five", value: .five)
TableColumn("Six", value: .six)
TableColumn("Seven", value: .seven)
TableColumn("Eight", value: .eight)
TableColumn("Nine", value: .nine)
TableColumn("Ten", value: .ten)
// adding the next line will cause the compiler to give the message: 'The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions' at the 'var body: some View {' line. Using Group to break things up gives the same message.
//TableColumn("Eleven", value: .eleven)
//TableColumn("Twelve", value: .twelve)
}
}
}
struct MyData {
static var viewData:[MyRowData] = [MyRowData(),MyRowData()]
}
struct MyRowData: Identifiable {
var id = UUID()
var one = "one"
var two = "two"
var three = "three"
var four = "four"
var five = "five"
var six = "six"
var seven = "seven"
var eight = "eight"
var nine = "nine"
var ten = "ten"
var eleven = "eleven"
var twelve = "twelve"
var bool = false
}
@available(macOS 12.0, *)
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}