Objective-C declared @property attributes (nonatomic, copy, strong, weak)

后端 未结 4 1208
攒了一身酷
攒了一身酷 2020-11-22 09:24

Can someone explain to me in detail when I must use each attribute: nonatomic, copy, strong, weak, and so on, for a decla

4条回答
  •  难免孤独
    2020-11-22 10:21

    This link has the break down

    http://clang.llvm.org/docs/AutomaticReferenceCounting.html#ownership.spelling.property

    assign implies __unsafe_unretained ownership.

    copy implies __strong ownership, as well as the usual behavior of copy semantics on the setter.

    retain implies __strong ownership.

    strong implies __strong ownership.

    unsafe_unretained implies __unsafe_unretained ownership.

    weak implies __weak ownership.

提交回复
热议问题