You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regarding the post on inheritance, @CasePathable is required to handle enums with associated values.
Extending the library with traits (["StructuredQueriesCasePaths"]) in Package.swift is straightforward. For a standard Xcode project (.xcodeproj), this is not as straightforward, because in Xcode 26.2 using Swift 6.1 the Traits column does not exist in the Xcode Project UI. One possible solution could be a local wrapper package, but this becomes cumbersome and not as automatic as mentioned in the post.
Adding swift-case-paths directly as a dependency doesn't remove the error:
"@Table can only be applied to enum types when the StructuredQueriesCasePaths package trait is enabled (from macro Selection)."
Am I doing something wrong, are there any workarounds I'm missing, or would it be better to avoid enums?
import Foundation
import OSLog
import SQLiteData
import CasePaths // Manually added
@TablestructRGB:Identifiable,Codable{letid:UUIDvarred:Doublevargreen:Doublevarblue:Doublevaralpha:DoublevarvariantID:Variant.ID}@TablestructVariant:Identifiable,Codable{letid:UUIDvarname:String=""varposition:Int=0varprofile:String?varswatchID:Swatch.ID}@TablestructElement:Identifiable{letid:UUIDletpaletteID:UUIDvarposition:Int=0varkind:Kind@CasePathable@SelectionenumKind:Codable{ // '@Table' can only be applied to enum types when the 'StructuredQueriesCasePaths' package trait is enabled (from macro 'Selection')
case swatch(Swatch)case scale(Scale)}}@TablestructSwatch:Identifiable,Codable{letid:UUIDvarname:String=""}@TablestructScale:Identifiable,Codable{letid:UUIDvarspaceModel:SpaceModel=.rgb
varswatches:[Swatch]enumSpaceModel:Int,Codable{case rgb =0case hsl
case hsv
}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Regarding the post on inheritance,
@CasePathableis required to handle enums with associated values.Extending the library with traits (["StructuredQueriesCasePaths"]) in Package.swift is straightforward. For a standard Xcode project (.xcodeproj), this is not as straightforward, because in Xcode 26.2 using Swift 6.1 the Traits column does not exist in the Xcode Project UI. One possible solution could be a local wrapper package, but this becomes cumbersome and not as automatic as mentioned in the post.
Adding
swift-case-pathsdirectly as a dependency doesn't remove the error:"
@Tablecan only be applied to enum types when theStructuredQueriesCasePathspackage trait is enabled (from macroSelection)."Am I doing something wrong, are there any workarounds I'm missing, or would it be better to avoid enums?
Beta Was this translation helpful? Give feedback.
All reactions