Here is my code ...
var accountType = "Account"
@FetchRequest(
sortDescriptors: [NSSortDescriptor(keyPath: \JMAccount.displayOrder, ascending: true)]
, predicate: NSPredicate(format: "(hidden < %@) AND (type == %@)", argumentArray: [Int(1), accountType])
, animation: .default
)
private var items: FetchedResults<JMAccount>
Then Xcode report error below ...
"Cannot use instance member 'accountType' within property initializer; property initializers run before 'self' is available"
How can I solve this error ?
More info, I want to make multiple view with parameter to @FetchRequest. So I try to make variable for this parameter. If you have better idea, please suggest me.