Xcode 15 Beta 3 (15A5195k) HelloWorld failed to build

This is the HelloWorld project from https://developer.apple.com/documentation/visionos/world

In ViewModel.swift, there are tons of:

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

I got this even after "Clean Build Folder"

I am getting this same error on the Destination Video example project

Hello, I haven’t verified it yet, but this might be linked to the following known issue from Xcode 15 beta 3 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.

This issue is listed in the beta 3 release note. And the workaround is to keep using beta 2....

Looks like the @Observable macro is broken in beta 3 if you target visionOS. If you download the Observation sample project, it builds fine as is. However as soon as you add visionOS as a target and build for the visionOS simulator, the same error appears.

Just filed this as FB12538400. Please file a Feedback on this as well, so that this can get fixed in the next beta.

Same error on the Diorama sample.

I am evaluating Xcode Version 15.0 beta 4 (15A5195m). Same problem.

Yup, beta 4 has the same problem

Solution: Using @Observable on a class that has a property that is a closure causes the Xcode beta 3/4 compiler to flip out. Using @ObservationIgnored on the said property will get the compiler to calm down.

update the Viewmodel code to this:


@Observable class ViewModel {
    
    // MARK: - Navigation
    @ObservationIgnored var navigationPath: [Module] = []
    @ObservationIgnored var titleText: String = ""
    @ObservationIgnored var isTitleFinished: Bool = false
    @ObservationIgnored var finalTitle: String = "Hello World"

    // MARK: - Globe
    @ObservationIgnored var isShowingGlobe: Bool = false
    @ObservationIgnored var globeEarth: EarthEntity.Configuration = .globeEarthDefault
    @ObservationIgnored var isGlobeRotating: Bool = false
    @ObservationIgnored var globeTilt: GlobeTilt = .none

    // MARK: - Orbit
    @ObservationIgnored var isShowingOrbit: Bool = false
    @ObservationIgnored var orbitEarth: EarthEntity.Configuration = .orbitEarthDefault
    @ObservationIgnored var orbitSatellite: SatelliteEntity.Configuration = .orbitSatelliteDefault
    @ObservationIgnored var orbitMoon: SatelliteEntity.Configuration = .orbitMoonDefault

    // MARK: - Solar System
    @ObservationIgnored var isShowingSolar: Bool = false
    @ObservationIgnored var solarEarth: EarthEntity.Configuration = .solarEarthDefault
    @ObservationIgnored var solarSatellite: SatelliteEntity.Configuration = .solarTelescopeDefault
    @ObservationIgnored var solarMoon: SatelliteEntity.Configuration = .solarMoonDefault

    @ObservationIgnored var solarSunDistance: Double = 700
    @ObservationIgnored var solarSunPosition: SIMD3<Float> {
        [Float(solarSunDistance * sin(solarEarth.sunAngle.radians)),
         0,
         Float(solarSunDistance * cos(solarEarth.sunAngle.radians))]
    }
}

gillesduif,

Confirmed! It compiled!

But when running at the Simulator I got:

nw_socket_copy_info [C1:2] getsockopt TCP_INFO failed 102

nw_socket_copy_info getsockopt TCP_INFO failed 102

AddInstanceForFactory: No factory registered for id <CFUUID 0x600003c24540> F8BB1C28-BAE8-11D6-9C31-00039315CD46

Class for component AccessibilityComponent already registered

Class for component ImageBasedLightComponent already registered

Component Shadow already registered

Component Shadow already registered

Unexpected CARE Entity state: CALayerClientComponent destroyed unexpectedly in the app. layerId: 6.611.696.850.093.839.007, contextId: 0, name: _MRUIPlatterOrnamentBackingWindow (com.example.apple-samplecode.World9X2AS5344F)

Unexpected CARE Entity state: CALayerClientComponent destroyed unexpectedly in the app. layerId: 9.506.802.391.458.032.199, contextId: 0, name: _MRUIPlatterOrnamentBackingWindow (com.example.apple-samplecode.World9X2AS5344F)

The app at the simulator freezes, there is no World only an empty window.

Xcode 15.0 beta 4 (15A5195m) macOS 14.0 Beta (23A5286i)

when replacing the code in modelvew as suggested clears the compiler errors everyone is experiencing but nothing shows when the build is running the apps on visionPro simulator

running the apps producing these errors but nothing becomes visible in the simulator

nw_socket_copy_info [C1:2] getsockopt TCP_INFO failed 102 nw_socket_copy_info getsockopt TCP_INFO failed 102 AddInstanceForFactory: No factory registered for id <CFUUID 0x6000002723e0> F8BB1C28-BAE8-11D6-9C31-00039315CD46

I can confirm that I am still receiving the following error in the "Hello World", "DestinationVideo" and "Diorama" Demo's in Xcode Version 15.0 beta 4 (15A5195m):

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

The "HappyBeam" Demo is the only one that currently runs.

Hi All,

It looks like the culprit is the Xcode beta4 Vision Pro Simulator. Try this: create an app using the Multiplatform template, change nothing, compile and send it to the Vison Pro simulator. It will freeze the same way Hello World freezes. Same happens with the Backyard Birds code sample from Apple. I guess it is also linked with the problems in the Preview window in Beta4. Better wait for Xcode beta5.

Regards, Johel

Diorama sample still fails to build using Xcode 15.0 beta 5

Xcode 15 Beta 3 (15A5195k) HelloWorld failed to build
 
 
Q