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

Realmビギナーが知っとくべき内容で打線組んだwww

yimajo
March 12, 2015

 Realmビギナーが知っとくべき内容で打線組んだwww

potatotips15 で発表した資料です
http://connpass.com/event/12140/

yimajo

March 12, 2015
Tweet

More Decks by yimajo

Other Decks in Technology

Transcript

  1. ଧॱ कඋ બख໊  ༡ 3FBMNͷಡΈํ͸ʮϨϧϜʯ  ೋ 3-.0CKFDUαϒΫϥεͷϓϩύςΟఆ͕ٛΧϥϜΛࣔ͢ 

    த /4/VMMOJMͰอଘͰ͖ͳ͍  Ұ ओΩʔ͸TUSJOH͔੔਺Ͱͳ͚Ε͹͍͚ͳ͍  ӈ /4%BUF͕ϛϦඵΛอଘͰ͖ͯͳ͍  ࡾ 3FBMN +40/͕ࣗಈͰ*40ܗࣜͷจࣈྻΛ/4%BUFʹ ͯ͠͠·͏  ࠨ +40/&YQPSUͷίʔυ͸OJMΛߟྀ͍ͯ͠ͳ͍  ั 3-.0CKFDUͷϓϩύςΟଐੑ͸ॻ͔ͳ͍͜ͱΛਪ঑  ౤ /4*OUFHFS͡Όͳ͘JOU@UΛ࢖͏΂͖࣌΋͋Δ 3FBMN DPDPB WΛ࢖༻ɻόά͸मਖ਼͞ΕͨΓ࢓༷΋มΘΔͨΊ಺༰͸ӏವΈʹ͠ͳ͍Ͱ͍ͩ͘͞
  2. @interface Dog : RLMObject @property NSString *name; @end ϞσϧͰςʔϒϧఆٛ ࢖͑Δܕ͸

    #00- CPPM JOU /4*OUFHFS MPOH  qPBU EPVCMF $('MPBU  /44USJOH /4%BUF /4%BUB  3-.0CKFDUͷαϒΫϥε
  3. @interface Dog : RLMObject @property NSString *name; @property NSNumber *age;

    // ௥Ճͨ͠ @end ϞσϧͰςʔϒϧఆٛ ࢖͑ͳ͍ܕͰఆٛͯ͠͠·͏ͱz࣮ߦ࣌ʹྫ֎zɻ ͜Ε͸୯७ϛεͳͷͰͦͷΫϥεΛར༻͢Δࡍʹ໰ ୊͕෼͔Δͷ͸خ͍͠ɻ
  4. + (NSDictionary *)JSONInboundMappingDictionary { return @{ @"id": @"identifier", @"created_at": @"createdAt"

    }; } Ϛοϐϯάϧʔϧྫ LFZ͕KTPOͷLFZ WBMVF͕Ϛοϐϯά͢ΔϓϩύςΟ໊
  5. ྫ - (instancetype)initWithDictionary:(NSDictionary *)dictionary { if(dictionary == nil || [dictionary

    isKindOfClass:[NSNull class]]){ return nil; } self = [super init]; if(![dictionary[@"id"] isKindOfClass:[NSNull class]]){ self.identifier = [dictionary[@"id"] integerValue]; } if(![dictionary[@"name"] isKindOfClass:[NSNull class]]){ self.name = dictionary[@"name"]; } return self; } ͨͩEJDUJPOBSZ<!lJEz>͕OJMͳΒ@JEFOUJpFS΋OJMʹͳΓྫ֎͕ ى͖ΔͷͰɺ͜ͷ৚݅ࣗମ΋ΧελϚΠζ͸ඞཁʹͳΔ
  6. w 3FBMNͰ͸ɺOPOBUPNJD BUPNJD TUSPOH DPQZ XFBLͷ Α͏ͳ0CKFDUJWF$ͷϓϩύςΟଐੑ͕ແࢹ͞Ε·͢ w 3FBMNͷதͰ͸ɺಠࣗͷ࠷దԽ͞Εͨଐੑ͕࢖ΘΕ·͢ɻ ͦͷͨΊɺࠞཚΛආ͚ΔͨΊʹɺ3FBMNϞσϧΫϥεΛએ

    ݴ͢Δͱ͖ɺϓϩύςΟଐੑΛ෇͚ͳ͍͜ͱΛਪ঑͍ͯ͠ ·͢ɻ w ϓϩύςΟଐੑΛ෇͚ͨ৔߹ɺ3-.0CKFDU͕3FBMNʹอ ଘ͞ΕΔ·Ͱ༗ޮʹͳΓ·͢ɻ ެࣜϦϑΝϨϯεΑΓ IUUQSFBMNJPKQEPDTDPDPB