nalexn / ViewInspector

Runtime introspection and unit testing of SwiftUI views
MIT License
2.09k stars 145 forks source link

Xcode 16.0 Beta 1 - Build failure: unable to type-check in reasonable time #307

Open nicholaslythall opened 3 weeks ago

nicholaslythall commented 3 weeks ago

When building the library with the Xcode 16.0 Beta 1, it fails with the following error:

ViewSearchIndex.swift:444:13: error: the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
            .init(count: sheetModifiers.count, { index -> UnwrappedView in
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Referencing this expression: https://github.com/nalexn/ViewInspector/blob/3f4f98dcff79ffd1eb530197f341c715595111b1/Sources/ViewInspector/ViewSearchIndex.swift#L458-L467

benfrearson commented 3 weeks ago

I'm seeing this error too. I wonder if there are build options that can work around this in the meantime?

KevinDoremy commented 2 weeks ago

Could it fix the problem ?

let sheetModifiersViews = .init(count: sheetModifiers.count) { index -> UnwrappedView in
    try sheetModifiers[index].builder(parent, index)
}

let actionSheetModifiersViews = .init(count: actionSheetModifiers.count) { index -> UnwrappedView in
    try actionSheetModifiers[index].builder(parent, index)
}

let alertModifiersViews = .init(count: alertModifiers.count) { index -> UnwrappedView in
    try alertModifiers[index].builder(parent, index)
}

let popoverModifiersViews = .init(count: popoverModifiers.count) { index -> UnwrappedView in
    try popoverModifiers[index].builder(parent, index)
}

return sheetModifiersViews + actionSheetModifiersViews + alertModifiersViews + popoverModifiersViews
sisoje commented 1 week ago

Could it fix the problem ?

let sheetModifiersViews = .init(count: sheetModifiers.count) { index -> UnwrappedView in
    try sheetModifiers[index].builder(parent, index)
}

let actionSheetModifiersViews = .init(count: actionSheetModifiers.count) { index -> UnwrappedView in
    try actionSheetModifiers[index].builder(parent, index)
}

let alertModifiersViews = .init(count: alertModifiers.count) { index -> UnwrappedView in
    try alertModifiers[index].builder(parent, index)
}

let popoverModifiersViews = .init(count: popoverModifiers.count) { index -> UnwrappedView in
    try popoverModifiers[index].builder(parent, index)
}

return sheetModifiersViews + actionSheetModifiersViews + alertModifiersViews + popoverModifiersViews

no, the .init is slow

sisoje commented 1 week ago

I'm seeing this error too. I wonder if there are build options that can work around this in the meantime?

point to some more recent commit hash?

benfrearson commented 1 week ago

I'm seeing this error too. I wonder if there are build options that can work around this in the meantime?

point to some more recent commit hash?

Well yeah it looks to have been addressed in #308. Have stopped using Xcode 16 for the moment, but I'd have thought this would fix it