Adopting Modern Objective-C

  • Change id to instancetype in appropriate places

  • Change enum to NS_ENUM or NS_OPTIONS

    • The NS_ENUM macro helps define both the name and type of the enumeration, in this case named UITableViewCellStyle of type NSInteger. The type for enumerations should be NSInteger.
  • 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] becomes dictionary[key] = @3.

posted @ 2017-02-22 11:11  三年幻想郷  阅读(101)  评论(0编辑  收藏  举报