Is it possible to use SwiftData?
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 28/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- swift
- Ambito
- build-system, tooling
Direzione di ricerca
Start by reading the reported example in Sources/tracker/Data.swift and running xtool dev to reproduce the missing SwiftDataMacros plugin error. Investigate whether xtool can support SwiftData macro expansion; the issue gives no implementation path or tests. Done means the example builds successfully, or the project documents that SwiftData is unsupported.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I'm really new to swift and i don't really know if it's a bug, so filing without the bug label. Thanks in advance for helping :)
if i do something like this:
import SwiftData
@Model
final class Person {
var firstName: String
var lastName: String
var relatives: [Person] = []
}
compilation will fail with a massive wall of repeating errors like this:
root@48e2171c8734:/ios/tracker# xtool dev
Planning...
[1/1] Planning build
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/ios/tracker/Sources/tracker/Data.swift:4:13: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
2 |
3 | @Model
4 | final class Person {
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
5 | var firstName: String
6 | var lastName: String
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:5:9: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
3 | @Model
4 | final class Person {
5 | var firstName: String
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
6 | var lastName: String
7 | var relatives: [Person] = []
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:6:9: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
4 | final class Person {
5 | var firstName: String
6 | var lastName: String
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
7 | var relatives: [Person] = []
8 | }
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:7:6: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
5 | var firstName: String
6 | var lastName: String
7 | var relatives: [Person] = []
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
8 | }
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:4:13: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
2 |
3 | @Model
4 | final class Person {
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
5 | var firstName: String
6 | var lastName: String
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:4:13: error: class 'Person' has no initializers
2 |
3 | @Model
4 | final class Person {
| `- error: class 'Person' has no initializers
5 | var firstName: String
| `- note: stored property 'firstName' without initial value prevents synthesized initializers
6 | var lastName: String
| `- note: stored property 'lastName' without initial value prevents synthesized initializers
7 | var relatives: [Person] = []
8 | }
/ios/tracker/Sources/tracker/Data.swift:4:13: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
2 |
3 | @Model
4 | final class Person {
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
5 | var firstName: String
6 | var lastName: String
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:5:9: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
3 | @Model
4 | final class Person {
5 | var firstName: String
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
6 | var lastName: String
7 | var relatives: [Person] = []
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:6:9: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
4 | final class Person {
5 | var firstName: String
6 | var lastName: String
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
7 | var relatives: [Person] = []
8 | }
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:7:6: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
5 | var firstName: String
6 | var lastName: String
7 | var relatives: [Person] = []
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
8 | }
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:4:13: error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
2 |
3 | @Model
4 | final class Person {
| `- error: external macro implementation type 'SwiftDataMacros.PersistentModelMacro' could not be found for macro 'Model()'; plugin for module 'SwiftDataMacros' not found
5 | var firstName: String
6 | var lastName: String
SwiftData.Model:3:320: note: 'Model()' declared here
1 | @available(swift 5.9)
2 | @available(macOS 14, iOS 17, tvOS 17, watchOS 10, *)
3 | @attached(member, names: named(_$backingData), named(persistentBackingData), named(schemaMetadata), named(init), named(_$observationRegistrar), named(_SwiftDataNoType), named(access), named(withMutation)) @attached(memberAttribute) @attached(extension, conformances: Observable, PersistentModel, Sendable) public macro Model() = #externalMacro(module: "SwiftDataMacros", type: "PersistentModelMacro")
| `- note: 'Model()' declared here
/ios/tracker/Sources/tracker/Data.swift:4:13: error: class 'Person' has no initializers
2 |
3 | @Model
4 | final class Person {
| `- error: class 'Person' has no initializers
5 | var firstName: String
| `- note: stored property 'firstName' without initial value prevents synthesized initializers
6 | var lastName: String
| `- note: stored property 'lastName' without initial value prevents synthesized initializers
7 | var relatives: [Person] = []
8 | }
[3/6] Compiling tracker Data.swift
Error: exit(1)
is it generally possible to use swiftData, and if no, could you recommend some alternative please?
P.S. probably shouldn't affect anything, but i'm building from a docker container because i couldn't set xtool up on my Nixos host
- Lingua principale
- Swift
- Stelle
- 5.5k
- Fork
- 163
- Merge medio
- 18h 29m
- PR unite (30g)
- 27
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di xtool-org/xtool
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 51/100
xtool-org/xtool#401 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
-
Error: exited(127)Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
xtool-org/xtool#376 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Feature Request] Add `xtool update` command for automatic CLI updatesForse già presa @Madhav008 l’ha presa oggi. Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
xtool-org/xtool#365 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di xtool-org/xtool
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
521xueweihan/HelloGitHub#4101 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
element-hq/element-x-ios#6405 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apple/coreai-models#380 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug 🐞
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
mozilla-mobile/firefox-ios#36278 ·
I maintainer di solito rispondono entro 1 giorno
-
product / auth product / console product / sites product / storage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno