skip to Main Content

“Expand Macro” stays gray even though I’ve seen the @Observable macro expanding earlier.

enter image description here

However when I manually trigger build error it does expand the location of the error. In this case I target macOS 13.5 that doesn’t support ObservationRegistrar.

enter image description here

I tried to restart Xcode, try different macros, different projects and types of projects.

2

Answers


  1. @Observable is only available in

    iOS 17.0+
    iPadOS 17.0+
    macOS 14.0+
    Mac Catalyst 17.0+
    tvOS 17.0+
    watchOS 10.0+
    visionOS 1.0+ Beta

    You cannot use it for macOS 13.5. I don’t think any of the macros work below macOS 14.

    Login or Signup to reply.
  2. I believe you are missing "import Observation" at the top of your file

    I ran into the same issue as it is not so straight forward that all the @observable macros "work" in code, they just cant be expanded without importing first.
    Seems like the compiler does not require the import, just XCode.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search