WWDC 2013 - Advances in Objective-C (404) Summary


Using a Framework

  • #import model issue
    • Header fragility
    • Non-scalable compile time
      • pre-compiled headers help significantly - maintenance burden / namespace pollution

Modules solve these issues

  • @import iAd;
    • Doesn't need to parse headers
    • Local macro definitions have no effect on framework API 
    • Autolinking - don't need to "link binary with libraries"
  • Selective import
    • @import iAd.ADBannerView;

Using Modules

  • #import and #include automatically mapped to @import
  • No source changes required
  • Mac OS X Mail shows 40% faster compile time with modules - didn't manage pre-compiled headers well 
  • For old project, enables it manually through the GUI
    • Build Settings / Apple LLVM 5.0 - Language - Modules / Enable Modules
  • Modules are not available for user framework

Tools support for modernisation

  • Edit / Refactor / Convert to Modern Objective-C Syntax …

Explicit Enums

  • NS_ENUM, NS_OPTIONS

Tagged Pointers

  • Added to 64 bit Cocoa
  • For small value like objects => stores object in the pointer itself => no malloc/free
    • NSNumber, NSDate, etc. 
    • Performance => 3x times more space efficient, 106 times faster to allocate/destroy
  • LSB 4 bits are not used from 64 bit CPU => to align pointer address
    • Use the bottom bit as discriminator bit for a tagged pointer

Garbage Collection

  • Replaced by ARC
  • Deprecated with OS X 10.8

Common CF APIs allow implicit bridging

  • Old: NSString *str = (__bridge NSString *)CFDictionaryGetValue(_dict, @"key);
  • New: NSString *str = CFDictionaryGetValue(_dict, @"key);

댓글

이 블로그의 인기 게시물

Wireless: HotSpot 2.0 이란?

Apple M1 Mac Mini에서 이더리움 (Ethereum) 채굴하기

Java: Java for Game? Java가 Game 개발에 어울릴까?