Loop through all object properties at runtime

前端 未结 3 1261
不思量自难忘°
不思量自难忘° 2020-12-05 05:59

I want to create an Objective-C base class that performs an operation on all properties (of varying types) at runtime. Since the names and types of the properties will not a

3条回答
  •  不知归路
    2020-12-05 06:26

    Adding some detial to @mvds:

    unsigned int count=0;
    objc_property_t *props = class_copyPropertyList([self class],&count);
    for ( int i=0;i

    Please give @mvds the upvote.

提交回复
热议问题