Post

Replies

Boosts

Views

Activity

SwiftUI MacOS TableColumn compiler can't type-check expression in reasonable time.
This compiles: Table(sortedTableData, selection: $selectedLongCallID, sortOrder: $sortOrder) {         Group {           TableColumn("Description", value: \LongCall.description) { Text($0.description) }.width(min: 200)           TableColumn("Qty", value: \LongCall.quantity) { Text("\($0.quantity)") }.width(min: 40)         }         Group {           TableColumn("Open Date", value: \LongCall.openDate) { Text($0.openDate.prettyDate()) }.width(min: 75)           TableColumn("Days Held", value: \LongCall.daysHeld) { Text("\($0.daysHeld)") }         }         Group {           TableColumn("Exp Date", value: \LongCall.expirationDate) { Text($0.expirationDate.prettyDate()) }.width(min: 75)           TableColumn("Days til Exp", value: \LongCall.daysTilExpiration) { Text("\($0.daysTilExpiration)") }         }         Group {           TableColumn("Debit Per Contract", value: \LongCall.openingDebitPerContract) { Text($0.openingDebitPerContract.formatToCurrency()) }           TableColumn("Total Debit", value: \LongCall.totalDebit) { Text($0.totalDebit.formatToCurrency()) }         }         Group {           TableColumn("Break Even Price", value: \LongCall.breakEvenPrice) { Text($0.breakEvenPrice.formatToCurrency()) }           TableColumn("Target Profit %", value: \LongCall.targetProfitPercentageDisplay) { Text($0.targetProfitPercentageDisplay)}         }         Group {           TableColumn("Target Profit", value: \LongCall.targetProfitDisplay) { Text($0.targetProfitDisplay) }           TableColumn("Loss Limit %", value: \LongCall.lossLimitPercentageDisplay) { Text($0.lossLimitPercentageDisplay) }         }       } This does not compile. Just added another Group. I get the dreaded "This compiler is unable to type-check this expression in a reasonable time": Table(sortedTableData, selection: $selectedLongCallID, sortOrder: $sortOrder) {         Group {           TableColumn("Description", value: \LongCall.description) { Text($0.description) }.width(min: 200)           TableColumn("Qty", value: \LongCall.quantity) { Text("\($0.quantity)") }.width(min: 40)         }         Group {           TableColumn("Open Date", value: \LongCall.openDate) { Text($0.openDate.prettyDate()) }.width(min: 75)           TableColumn("Days Held", value: \LongCall.daysHeld) { Text("\($0.daysHeld)") }         }         Group {           TableColumn("Exp Date", value: \LongCall.expirationDate) { Text($0.expirationDate.prettyDate()) }.width(min: 75)           TableColumn("Days til Exp", value: \LongCall.daysTilExpiration) { Text("\($0.daysTilExpiration)") }         }         Group {           TableColumn("Debit Per Contract", value: \LongCall.openingDebitPerContract) { Text($0.openingDebitPerContract.formatToCurrency()) }           TableColumn("Total Debit", value: \LongCall.totalDebit) { Text($0.totalDebit.formatToCurrency()) }         }         Group {           TableColumn("Break Even Price", value: \LongCall.breakEvenPrice) { Text($0.breakEvenPrice.formatToCurrency()) }           TableColumn("Target Profit %", value: \LongCall.targetProfitPercentageDisplay) { Text($0.targetProfitPercentageDisplay)}         }         Group {           TableColumn("Target Profit", value: \LongCall.targetProfitDisplay) { Text($0.targetProfitDisplay) }           TableColumn("Loss Limit %", value: \LongCall.lossLimitPercentageDisplay) { Text($0.lossLimitPercentageDisplay) }         }         Group {                     }       } The only reason I have two TableColumns per group is because that's the only way it would compile. If I add 3, it gives me the "reasonable time" error. I should be able to have up to 10 per Group. This is valid Swift code and since adopting SwiftuI, I spend more time reformatting code to get around this compiler error than anything else. What am I supposed to do here to have more than 10 TableColumns? What's the secret?
2
1
995
Apr ’22