Post

Replies

Boosts

Views

Activity

Xcode 16 broke my SwiftData application
I'm building an application with SwiftUI and SwiftData. Up until a couple days ago, everything was working fine. Then, Xcode auto-updated to v16 in the background, and the next time I opened Xcode and tried to build my app it wouldn't build anymore, citing some errors in expanding the SwiftData @Model macro on one of my objects. Attached are the errors specifically, shown where Xcode shows them (in the expanded @Model macro). In text, they are: Instance method 'access(_:keyPath:)' requires that 'Member' conform to 'Observable' Cannot convert value of type 'Risers.Member' to expected argument type 'Member' Instance method 'withMutation(of:keyPath:_:)' requires that 'Member' conform to 'Observable' Cannot convert value of type 'Risers.Member' to expected argument type 'Member' Here is the SwiftData class in full: import SwiftData import SwiftUI @Model class Member: Identifiable, Hashable { var chorus: Chorus? var id = UUID() var firstName: String var lastName: String var fullName: String { "\(firstName) \(lastName)" } var voicePart: Int var voicePartString: String? { chorus?.voicePartType.prettyName(forPart: voicePart) } @Attribute(.externalStorage) var pictureData: Data init(chorus: Chorus? = nil, firstName: String = "", lastName: String = "", voicePart: Int = 1, pictureData: Data = Data()) { self.chorus = chorus self.firstName = firstName self.lastName = lastName self.voicePart = voicePart self.pictureData = pictureData } init(member: Member) { self.chorus = member.chorus self.firstName = member.firstName self.lastName = member.lastName self.voicePart = member.voicePart self.pictureData = member.pictureData } I tried building again on Xcode 15.4, and it still builds successfully there. Xcode 16.1 beta has not made a difference. Is this my fault, or is Xcode 16 broken?
4
1
596
Sep ’24