ios - How to test if a variable is declared? -
I can test that an asset exists in this way:
#import & Lt; Objc / runtime.h & gt; - (zero) testcachedPublicFeedExists {objc_property_t prop = class_getProperty ([store class], "cachedPublicFeed"); XCTAssertTrue (hop); } But how can I test if a class variable like cachedvar exists? @interfaceFTDataStoreBase: NSObject {NSMutableArray * cachedVar; }
You can use these methods class_getInstanceVariable Or Class_getClassVariable . - (zero) testcachedVarExists {Ivar ivar = class_getInstanceVariable ([Store class], "CachedWire"); XCTAssertTrue (Ever); } Learn more.
Comments
Post a Comment