用@ObservedObject包装的属性形成NSPredicate不会返回任何内容。但是,删除包装后,它将返回正确的条目

时间:2019-12-28 08:19:47

标签: swift swiftui

OwnerModel是NSManagedObject的子级,当我删除包装器时,请求将返回所需的所有者。当我离开它时,它什么也不会返回!

struct OwnerCell: View {
    @ObservedObject var owner: OwnerModel    
    private var cashListView: some View {
        let predicate = NSPredicate(format: "owner = %@", owner)
        return CashItemListView(owner: owner, request: CashItemModel.sortedFetchRequest(using: predicate))
    }

    var body: some View {
        // view code
    }
}

0 个答案:

没有答案