Why Naming Your SwiftData Model 'Tag' Breaks Your Build (+ Xcode 16 .gitkeep Trap)
What I Was Trying to Do I started a new document scanning app and was setting up SwiftData models using TDD. Simple Document and Tag models: @Model class Tag { var name: String var color: String @Relationship(inverse: \Document.tags) var documents: [Document] } Built fine. No issues so far. Trap #1: That’s Not Your Tag The moment I used FetchDescriptor in a test file, it blew up: let fetched = try context.fetch(FetchDescriptor<Tag>()) error: 'Tag' is ambiguous for type lookup in this context Turns out SwiftUI already has a Tag type — the one used for identifying selection items in TabView and Picker. When your test file imports both @testable import scansort and SwiftUI (via SwiftData), the compiler can’t decide which Tag you mean. ...