Does Objective-C forbid use of structs?

前端 未结 3 795
执念已碎
执念已碎 2021-02-20 02:53

I\'m new to Objective C

I tried using a simple struct and got

arc forbids objective-c objects in struct

Looking up ARC, it

3条回答
  •  一生所求
    2021-02-20 03:29

    If you want to use struct in Objective C ( with ARC) use "__unsafe_unretained" attribute.

    struct Address {
       __unsafe_unretained NSString *city;
       __unsafe_unretained NSString *state;
       __unsafe_unretained NSString *locality;
    };
    

提交回复
热议问题