4

I have a large mixed language (obj-c, swift & c++) project, it builds and runs fine on all platforms

"Build for previews" also seems to complete fine.

Opening preview of a particular swift file fails, e.g.: enter image description here

Diagnostics gives:


Failed to launch swiftc.

==================================

|  HumanReadableNSError: NSInvalidArgumentException
|  
|  com.apple.dt.PreviewsFoundation.ExceptionError (0):
|  ==NSLocalizedFailureReason: too many arguments (4670) -- limit is 4096

I have managed to get previews to work previously. I switched to using prebuilt xcframeworks in the hope of improving the preview build performance, but has gone from slow to not working at all!

Nick Hingston
  • 8,724
  • 3
  • 50
  • 59
  • Same problem here. Did you manage to find a solution for this? – Tomas Andrle Aug 10 '22 at 14:45
  • 1
    I did get it working, but what I did was to rewrite the view somewhat - so there is nothing concrete I can attribute it to, I'm afraid. It was quite a complex view which I broke down into smaller ones...so my best guess is some kind of cyclomatic complexity issue... – Nick Hingston Aug 10 '22 at 14:57
  • cool, but I have this error on a view that is literally var body: some View { Text("Hello, World!") } – Kamil Nomtek.com Sep 06 '22 at 12:29
  • Oh, wow. Can you reproduce on a reasonably clean project? Worth raising a radar bug I imagine... – Nick Hingston Sep 06 '22 at 15:07
  • Unfortunately not, the project is big and under NDA, but this is a newly generated module with an (almost) empty view and it doesn`t work – Kamil Nomtek.com Sep 07 '22 at 07:40
  • Turns out now I have this error on _every_ view in the project. Also, counted the number of .swift files in the project and it's 2033, so not related to the error message which in my case says `too many arguments (4323)`. – Kamil Nomtek.com Sep 07 '22 at 12:41
  • I suggest you create a new build target, and add just the swift UI files you want to preview - stub any of the model/data layer/observable object logic. – Nick Hingston Sep 07 '22 at 16:04

0 Answers0