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

1時間で作るSwiftアプリ / Swift Application in an hour

1時間で作るSwiftアプリ / Swift Application in an hour

503b1ca28b167b0d94a5992aad1a57b1?s=128

horimislime

October 14, 2014
Tweet

Transcript

  1. 1࣌ؒͰ࡞ΔSwiftΞϓϦ Swift Study ୈࡾճ

  2. ✓ CocoaPods
 → gem install cocoapods ✓ ͻͳܗίʔυ
 → https://github.com/horimislime/SwiftNewsReaderSample

    ✓ directory rootͰ pod install Լ४උ
  3. ຊ೔ͷ಺༰ SwiftΛ࢖ͬͨ؆୯ͳΞϓϦ࡞੒ ίʔυΛॻ͖ͳ͕Βߏจͷ͓͞Β͍ iOS։ൃ΋ະܦݧͳਓΛ૝ఆ͍ͯ͠·͢

  4. ࡞Δ΋ͷ RSSϦʔμʔ γϯϓϧʹTableViewͰهࣄΛ දࣔ͢Δ

  5. खॱ1 ςʔϒϧϏϡʔΛ༻ҙ͢Δ ViewController.swift Λվ଄͢Δ UITableViewControllerͷܧঝΫϥεʹมߋ͢Δ ࠷௿ݶඞཁͳϝιουΛOverride͢Δ

  6. खॱ2 χϡʔεهࣄͷσʔλΛಡΈࠐΉ HTTP௨৴ͰJSONσʔλΛऔಘ͢Δ
 → URL͸ https://api.myjson.com/bins/4dx6g parseͯ͠NSDictionaryͷ഑ྻʹಡΈࠐΉ ಡΈࠐΜͩهࣄΛςʔϒϧʹදࣔ͢Δ

  7. खॱ3 ը૾ΛඇಉظͰಡΈࠐΉ parseͨ͠JSON಺ͷը૾URLΛಡΈࠐΉ ௨৴͸ඇಉظͰߦ͍ɺUIImageͰදࣔ͢Δ Ұ୴library͸࢖ΘͣɺGCDͰ΍ͬͯΈΔ

  8. खॱ4 ηϧΛλοϓͯ͠هࣄΛදࣔ͢Δ ηϧΛλοϓͨ͠ࡍͷΠϕϯτΛhandle͢Δ tableͷԿ൪໨ͷηϧ͕બ୒͞Ε͔ͨ൑ఆ͢Δ
 →͜ΕΛݩʹهࣄ഑ྻ͔ΒσʔλΛऔΓग़͢ ֘౰ͷهࣄΛදࣔ͢ΔUIWebView΁ભҠ͢Δ

  9. ͓·͚1 3rd-partyϥΠϒϥϦΛ࢖ͬͯΈΔ ը૾ಡΈࠐΈʹSDWebImageΛ࢖ͬͯΈΔ ಡΈࠐΈதSVProgressHUDͰϩʔυը໘Λग़͢ ༧Ίpod install͓͍͍ͯͯͩ͘͠͞

  10. ͓·͚2 ςετΛॻ͍ͯΈΔ SwiftͰBDDͳςετΛॻ͍ͯΈΔ Swift੡ςετϥΠϒϥϦQuickΛclone͢Δ CocoaPods͸·ͩSwift libraryະରԠͱͷࣄ

  11. SwiftΛ৮ͬͯΈͯ Obj-CΑΓ͸Δ͔ʹ௚ײత & ॻ͘ྔݮΔ ͪΌΜͱݴޠ࢓ֶ༷͹ͳ͍ͱྑ͕͞ग़ͤͳͦ͏
 → Scala࢖͍͜ͳͤͯͳ͍JavaΤϯδχΞతͳ… ୯ମςετ͚ͩͰ΋SwiftԽ͢Δͷ͸ྑͦ͞͏
 ˠӡ༻ϓϩδΣΫτͰ΋ಋೖ͕༰қ

  12. None