Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Breaking changes for Foundation API

Breaking changes for Foundation API

9bf923e39671cde83584e3e926296c13?s=128

Kishikawa Katsumi

July 14, 2015
Tweet

More Decks by Kishikawa Katsumi

Other Decks in Programming

Transcript

  1. Breaking changes for Foundation API in iOS 9

  2. https://github.com/kishikawakatsumi/ Kishikawa Katsumi http://kishikawakatsumi.hatenablog.com/

  3. None
  4. Next Realm Meetup • 7/23ʢ໦ʣ • 19:00ʙ • Sansanגࣜձࣾ

  5. NSMutableDictionary - (void)setObject:(nullable ObjectType)obj forKeyedSubscript:(KeyType <NSCopying>)key Xcode 7beta

  6. NSMutableDictionary - (void)setObject:(nullable ObjectType)obj forKeyedSubscript:(KeyType <NSCopying>)key Xcode 7beta

  7. nilΛ୅ೖ͢Δͱྫ֎ => ཁૉͷ࡟আ NSMutableDictionary<NSString *, NSNumber *> *dic = [[NSMutableDictionary

    alloc] init]; dic[@"key"] = @(1); NSLog(@"%@", dic); // => {"key": 1} dic[@"key"] = nil; NSLog(@"%@", dic); // => {}
  8. Xcode 6.x dic[@"key"] = nil; // NSInvalidArgumentException

  9. NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; dictionary[@"id"] = model.identifier; if

    (self.name) { dictionary[@"name"] = model.name; } if (self.email) { dictionary[@"email"] = model.email; }
  10. NS_REFINED_FOR_SWIFT Xcode 7beta

  11. #if !defined(SWIFT_CLASS_EXTRA) || (defined(SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH) && SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH >= 5) - (nullable

    id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0) NS_REFINED_FOR_SWIFT; #else - (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0); #endif