Swift-Syntax Prebuilts for use in iOS apps at run-time?

It seems, per [Preview] Swift-Syntax Prebuilts for Macros , that Swift-Syntax Prebuilts are expressly intended to allow uses for macros. If an iOS library depends on Swift-Syntax for doing things at run-time, then it seems the toolchain will ignore the pre-built and build Swift-Syntax from source.

In my case, the run-time use is in service of unit tests (specifically, pointfreeco/swift-macro-testing), and does not run on users' devices.

I believe this is related to Prebuilts for all host targets by dschaefer2 · Pull Request #9905 · swiftlang/swift-package-manager · GitHub , but not exactly the same thing. That PR says "Add support for prebuilts for all targets that build for host." But I think that would exclude iOS, right?[1]

  1. Am I correct that the above PR is related but not exactly the same as my issue?
  2. Is the issue I'm raising here, about including prebuilts for iOS (at least simulators, if not devices), something that…
    1. …is supposed to be supported now?
    2. …is intended to be supported in the future?

I can supply a reproducing project if anything is unclear, or if I'm missing some nuance, but I wanted to get a high-level vibe check first.

(Edit: removed a claim about which things use the prebuilts because I think I had it wrong, but the overall question still stands.)


  1. Unless you're doing this all in the context of Swift Playgrounds or a hypothetical Xcode for iPad, I guess, but I'm just talking about using Xcode on macOS to build iOS apps. ↩︎

Hi,

Macros don’t have runtimes they are expanded during compilation (you can very well copy paste, renames $ prefixed symbols and keep it working without macro). So they run where you compile code, unless you are making a compiler hosted on iOS (which i think Apple doesn’t allow) you don’t expand macros there. Prebuilts should work without you doing anything but if it isn’t the case look at your exact version of swift and then check whether prebuilts are available for it. Sometimes they aren’t readily available or even removed when there were buggy or something. Hope I’m not answering wrong as this is pretty much accumulated by experience having them working sometimes but not always :)

Thanks for your reply. In this case, the test library in question is using Swift-Syntax at run time to parse the syntax of the test source file in order to make changes to the file itself during the test run, to capture inline textual snapshots of the subject under test.

Ha gotcha sorry for the noise then