Unknown attribute 'Observable' error

While following the course, iOS Networking (2023), module 3 lesson 5, I see this error on my Xcode build:

Unknown attribute ‘Observable’

from the lines below:

import Foundation
import SwiftUI

@Observable
class ViewModel {

}

Line, @Observable seems not working for me.
Thank you for your help!

What version of Xcode do you have? The @Observable macro is only available in Xcode 15.

Thank you for the response. I changed the lines for the commands for my Xcode 14 in the meantime. Unfortunately, I can’t update my MacOS and Xcode because my MacBook Pro is now so old.

1 Like

I see this course is set for Xcode 15 and part of codes is not working for me because I am using Xcode 14. I can’t install Xcode 15 though because again, my macbook pro is old. I tried to use cloud macs but I didn’t like it.
So, is there any possibility of that you can also provide the code piece that works in Xcode 14?
I partially made it work by using Xcode 14 commands for Map Views, but I am now stuck at the point where I can’t really figure out what to do.

Thanks,

Unfortunately the computer software industry is in a constant state of advancing into new features so I doubt that Chris Ching would be considering providing code for earlier versions of Xcode.

When submitting Apps to the App Store, the latest version of Xcode must be used so that means that hardware (computers) and software need to be up to date.