I have a Package.swift file that builds and runs from Xcode 15.2 without issue but fails to compile when built from the command line ("swift build"). The swift version is 6.0.3. I'm at wits end trying to diagnose this and would welcome any thoughts.
The error in question is
error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
The code associated with the module is very vanilla.
import Foundation
import SwiftData
@Model
public final class MyObject {
@Attribute(.unique) public var id:Int64
public var vertexID:Int64
public var updatedAt:Date
public var codeUSRA:Int32
init(id:Int64, vertexID:Int64, updatedAt:Date, codeUSRA:Int32) {
self.id = id
self.vertexID = vertexID
self.updatedAt = updatedAt
self.codeUSRA = codeUSRA
}
public static func create(id:Int64, vertexID:Int64, updatedAt:Date, codeUSRA:Int32) -> MyObject {
MyObject(id: id, vertexID: vertexID, updatedAt: updatedAt, codeUSRA: codeUSRA)
}
}
Thank you.