0
votes

Please send me some links on how to use NSOutlineView with NSTreeController bindings with using core data.

https://www.dropbox.com/s/em7kxjqmxqjto88/outlineViewCoreData%20copie.zip?dl=0 this example is ok

https://www.dropbox.com/s/1asg3kkf9ltwj2w/outlineViewCoreData.zip?dl=0 this example is ko. ==> why

the entity EntityCategory is not key value coding-compliant for the key "category".

1
I have already looked, but I did not find anything very interesting - thierryH
I do not go out why in my example I have the entity EntityCategory is not key value coding-compliant for the key "category". it's a nsset - thierryH
EntityCategory is a subclass of NSManagedObject. The problem is: NSTreeController has only one childrenKeyPath for all obhects. - Willeke

1 Answers

0
votes

I have found the solution

All is ok

https://www.dropbox.com/s/nnh0e0atwmrqpmm/outlineViewCoreDataOK.zip?dl=0

i have add

extension EntityCategory {

    @objc var  children : NSSet {
        return []
    }
    
    @objc var count : Int {
        return 0
    }
    
    @objc var isLeaf : Int {
        return 1
    }
    
}

and

extension EntityAffectation {

    @objc var  children : NSSet {
        return category!
    }

    @objc var count : Int {
        return category!.count
    }

    @objc var isLeaf : Int {
        return 0
    }

}

and

enter image description here