0

After updating Xcode to 15 beta 3, errors started appearing on the var properties of my @Observable models when building my project for Apple Vision Pro.

Expansion of macro 'ObservationTracked' produced an unexpected 'init' accessor

There's also this error. I think it's related:

External macro implementation type 'ObservationMacros.ObservableMacro' could not be found for macro 'Observable()'; the type must be public and provided by a macro target in a Swift package, or via '-plugin-path' or '-load-plugin-library'

Clément Cardonnel
  • 4,232
  • 3
  • 29
  • 36

2 Answers2

3

Apparently, Xcode 15 beta 3 introduced a regression for this specific case. As mentioned in the release notes.

  • visionOS projects that use the @Observable property wrapper will fail to build in Xcode 15 beta 3. (111494849) Workaround: Continue using Xcode 15 beta 2.

If you are making an app for Apple Vision Pro and are making use of the new Observation framework, you better stay away from the third beta and stick to Xcode 15 beta 2.

EDIT: It looks like beta 5 works now. Please make sure there's no space in the Xcode app name as @Jari mentioned.

Clément Cardonnel
  • 4,232
  • 3
  • 29
  • 36
  • 3
    This is still an issue in Xcode 15 beta 4 – svarrall Jul 12 '23 at 01:30
  • I am getting this error in Apple's official Diorama tutorial. Does this mean their tutorials are not compatible with XCode releases?https://developer.apple.com/documentation/visionos/diorama – Zach Jul 18 '23 at 18:30
  • @Zach, I think if you tried these sample codes with Xcode 15 beta 1 or 2, they would probably work. They will most likely work with future versions, as soon as they fix this bug. – Clément Cardonnel Jul 19 '23 at 09:56
  • Can confirm that Apple's "Hello World" Demo is still throwing the mentioned errors in Xcode 15 beta 4 with VisionOS Simulator 1.0 – Allan Berger Jul 25 '23 at 15:26
  • Also receiving the error in the "DestinationVideo" and "Diorama" Demo's in Xcode Version 15.0 beta 4 (15A5195m). The "HappyBeam" Demo is the only one that currently runs. – Allan Berger Jul 25 '23 at 16:19
  • I've just tested Beta 5 so you don't have to. There are still errors, albeit with a different message this time around (I've updated the original question). Let's hope Beta 6 finally fixes it! – Clément Cardonnel Jul 31 '23 at 07:13
1

Make sure you don't have spaces in the filename of the Xcode app. Renaming the app file from "Xcode-beta 2" to "Xcode-beta-2" fixed the missing macro issue for me.

Jari Jokinen
  • 770
  • 3
  • 13