Concepts
In the field of runtime, there are four concepts about this issue:
Reference Type | Struct Type | Description |
---|---|---|
Method | objc_method | An opaque type that represents a method in a class definition. |
Ivar | objc_ivar | An opaque type that represents an instance variable. |
Category | objc_category | An opaque type that represents a category. |
objc_property_t | objc_property | An opaque type that represents an Objective-C declared property. |
Ivar vs Property
Ivar | Property | |
---|---|---|
nonatomic | ❌ | ✅ |
copy | ❌ | ✅ |
@protected | ✅ | ❌ |
@ package | ✅ | ❌ |
参考
- Reason to use ivars vs properties in objective c – Stack Overflow
- objective c – Why would you use an ivar? – Stack Overflow
- Objective-C: properties vs ivars – Rollout.io Blog
- Difference between iVar and Property. – iPhone Dev SDK
- Private properties, methods and ivars in Objective-C
- Ram’s Blog • iOS: Property vs Instance Variable
- Slick’s Definitive Guide To Properties – iPhone Dev SDK