Adopting Modern Objective-C
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Adopting Modern Objective-C相关的知识,希望对你有一定的参考价值。
-
-
Change
id
toinstancetype
in appropriate places -
Change
enum
toNS_ENUM
orNS_OPTIONS
- The
NS_ENUM
macro helps define both the name and type of the enumeration, in this case namedUITableViewCellStyle
of typeNSInteger
. The type for enumerations should beNSInteger
.
- The
-
Update to the
@property
syntax
-
-
-
Converting to literals, so a statement like
[NSNumber numberWithInt:3]
becomes@3
. -
Using subscripting, so a statement like
[dictionary setObject:@3 forKey:key]
becomesdictionary[key] = @3
.
-
以上是关于Adopting Modern Objective-C的主要内容,如果未能解决你的问题,请参考以下文章