What does @NSManaged do?

后端 未结 3 1153
心在旅途
心在旅途 2021-01-30 06:55

I have encountered this keyword in various occasions. I kind of know what it\'s suppose to do. But I really want a better understanding of it.

What I noticed about

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-30 07:13

    Yes, it kinda really acts like @dynamic -- technically it might be identical even. Semantically there is a slight difference:

    @dynamic says 'compiler, don't check if my properties are also implemented. There might be no code you can see but I guarantee it will work at runtime'

    @NSManaged now says 'compiler, don't check those properties as I have Core Data to take care of the implementation - it will be there at runtime'

    so you could even say: @NSManaged is syntactic sugar that is a more narrow version of dynamic :)


    https://github.com/KyoheiG3/DynamicBlurView/issues/2
    here someone even used @NSManaged without CD because he wanted the @dynamic behaviour

提交回复
热议问题