Skip to content

Objective-C KVC, KVO的实现源码,根据 Foundation.framework汇编反写而来,还原iOS对KVO,KVC的真实实现

Notifications You must be signed in to change notification settings

yFeii/DIS_KVC_KVO

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DIS_KVC_KVO

根据IOS Foundation框架汇编反写的KVC,KVO实现,可以在mac, IOS环境下运行调试, KVC与KVO实现机制密不可分,所以将它们作为一个工程。

主要用作学习与研究,加深对KVC,KVO机制的理解,理解oc runtime在这些机制实现中的重要作用.

为了在xcode里正确编译调试,工程代码命名遵循一个规则:
和系统冲突的地方全部用D或者d_前缀修饰. 比如:

Category NSObject+NSKeyValueCoding, 在工程实现中改名为NSObject+DSKeyValueCoding
同理:
方法 - (id)valueForKey:(NSString *)key ==> - (id)d_valueForKey:(NSString *)key

方法 - (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context ==> - (void)d_addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context

...

NSKeyValueObservance ==> DSKeyValueObservance

NSKeyValueChangeDictionary ==> DSKeyValueChangeDictionary

...

About

Objective-C KVC, KVO的实现源码,根据 Foundation.framework汇编反写而来,还原iOS对KVO,KVC的真实实现

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 99.8%
  • C 0.2%