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

RubyMotionについて #mixiwwdc

ainame
June 24, 2013

RubyMotionについて #mixiwwdc

WWDCに行ってきたけど内容については一切話せません @ mixi
にて発表

ainame

June 24, 2013
Tweet

More Decks by ainame

Other Decks in Programming

Transcript

  1. RubyMotionʹ͍ͭͯ
    2013-06-25
    גࣜձࣾϛΫγΟ @ainame

    View full-size slide

  2. RubyMotionͱ͸
    RubyMotion is a revolutionary
    toolchain for iOS.
    It lets you quickly develop and test
    native iOS applications for iPhone
    or iPad, all using the awesome
    Ruby language you know and love.

    View full-size slide

  3. ຊൃදΛߦ͏@ainame͸iOS։ൃΛ
    ຊ֨తʹۀ຿Ͱߦ͏͜ͱແ͘
    ࠓ೥ͷ3݄ࠒ͔ΒRubyMotionΛܦ༝ͯ͠
    iOS։ൃ஌ࣝΛಘͨͷΈͷएഐऀͰ͢ɻ
    ຊൃද͸Objective-C΍Titanium mobile΍PhoneGapΛ
    ᩫΊΔҙਤ͸શ͍͘͟͝·ͤΜɻ
    ෆద੾ͳൃݴ͕ग़ͯ͠·͏͜ͱ΋
    ͋Δ͔΋͠Ε·ͤΜ͕·͕ྃ͢͝ঝԼ͍͞ɻ

    View full-size slide

  4. ࣗݾ঺հ
    @ainame / Satoshi Namai
    גࣜձࣾϛΫγΟ - ϓϩάϥϚ
    झຯRubyͰձࣾͰ͸PerlΛॻ͍͍ͯ·͢
    ࠷ۙεϚϗΤϯδχΞͬΆ͕͞ग़͖ͯͨ
    emacsͷ֦ு motion-mode.el ࡞ͬͯ·͢

    View full-size slide

  5. ࠓ೔ͷ࿩୊
    RubyMotionͱ͸ ✔
    ࣗݾ঺հ ✔
    RubyMotion vs Titanium mobile/Phone Gap
    RubyMotion vs Objective-C
    RubyMotionʹΑΔiOS։ൃͷՄೳੑ
    ·ͱΊ

    View full-size slide

  6. RubyMotion vs
    Titanium mobile/PhoneGap
    ͲͪΒ΋Objective-CҎ֎ͰiOSΞϓϦॻ͚Δ
    ͦ΋ͦ΋ͪΌΜͱ࢖͑Δͷʁ
    Titaniumͱ͔Phone Gapͱ͸Կ͕ҧ͏ͷʁ

    View full-size slide

  7. RubyMotionͷ͕͜͜ҧ͏
    Objective-CͷRuntime্ʹ࣮૷͞ΕͨRuby
    ϒϦοδͰͳ͍
    ଎͍
    Objective-Cͱ௚઀ϦϯΫͰ͖Δ
    ࣮ફRubyMotion(@naoya_ito) ΑΓ
    https://speakerdeck.com/naoya/shi-jian-rubymotion

    View full-size slide

  8. పఈൺֱ!!
    ࢓૊Έ ࢖༻ݴޠ ։ൃ؀ڥ
    औΓר͘
    ؀ڥ
    Android
    ରԠ
    Ձ֨
    RubyMotion
    Titanium
    Mobile
    Phone Gap
    ωΠςΟϒ
    ΞϓϦ
    Ruby
    shell + editor
    or
    RubyMine(IDE)
    rubygems
    cocoapods
    ☓ $199
    ϋΠϒϦο
    υΞϓϦ
    ΄΅
    JavaScript
    Titanium
    Studio
    (Eclipseϕʔε)
    Appcelerator
    Platform
    ʢ༗ঈʣ
    ̋
    $0
    ༗ঈ൛
    ͋Γ
    Webϕʔε
    ϋΠϒϦο
    υΞϓϦ
    HTML5 +
    JavaScript
    shell + editor
    deploy→Xcode
    jQueryMobile
    ౳ͷ
    ϥΠϒϥϦ
    ̋ $0
    ˎRubyMotionҎ֎͸ٸᬎௐ΂ͨͷͰෆਖ਼͔֬΋͠Ε·ͤΜ

    View full-size slide

  9. ൺֱ·ͱΊ
    Pros
    ωΠςΟϒΞϓϦ
    CocoaPods࢖͑Δʂʂʂʂʂʂ
    CocoaTouchΛ஌ͬͯΕ͹ॻ͚Δ
    JSΑΓΦϒδΣΫτࢦ޲Ͱॻ͖΍͍͢
    Cons
    Android͸࢖͑ͳ͍
    ࠷ॳ͔Β༗ྉ

    View full-size slide

  10. ࠓ೔ͷ࿩୊
    RubyMotionͱ͸ ✔
    ࣗݾ঺հ ✔
    RubyMotion vs Titanium mobile/Phone Gap ✔
    RubyMotion vs Objective-C
    RubyMotionʹΑΔiOS։ൃͷՄೳੑ
    ·ͱΊ

    View full-size slide

  11. RubyMotion vs Objective-C
    Θ͔Γ΍͘͢͢ΔͨΊ vs Objective-Cͱݴ͍·ͨ͠
    πʔϧνΣΠϯͱݴޠͷൺֱ͸ਖ਼͘͠ͳ͍
    XcodeʴObjective-CΛ༻͍ͨඪ४తͳ։ൃͱͷൺֱ
    ൺֱ߲໨
    1. ࢖༻͢ΔݴޠɿRuby vs Objective-C
    2. ։ൃ؀ڥ ɿShell + Editor vs Xcode
    3. ҆৺ײɹɹɹɿϥΠϒϥϦ΍αϙʔτͳͲ

    View full-size slide

  12. Ruby vs Objective-Cͦͷ̍
    Objective-CͰग़དྷΔ͜ͱ͸RubyͰ΄΅ग़དྷΔ
    Rubyͷඪ४Ϋϥε͸NSObjectΛϕʔεʹ࡞ΒΕͯΔ
    ऑࢀরɺϙΠϯλɺGCD΋ઐ༻ΠϯλʔϑΣΠε͋Γ
    ϝϞϦ؅ཧ
    Objective-C: ARC, MRC
    RubyMotion: ARC෩ͷಠࣗ؅ཧ
    Πϯελϯεม਺ʹ୅ೖ͢ΔͱΧ΢ϯτ͞ΕΔ౳

    View full-size slide

  13. Ruby vs Objective-Cͦͷ̎
    ܕ෇͚
    Objective-Cɿ੩తͳܕνΣοΫ͋Γ
    RubyɿϏϧυ࣌ͷνΣοΫ͸ͳ͍
    ϝλϓϩάϥϛϯά
    Objective-CɿΠϯετϩϖΫγϣϯ, performSelector,
    method swizzling
    RubyɿΠϯετϩϖΫγϣϯ, send, define_method,
    instance_eval, alias_method, ΦʔϓϯΫϥε,
    ԋࢉࢠ(=ϝιου)Φʔόʔϩʔυ,...

    View full-size slide

  14. Ruby vs Objective-Cͦͷ̏
    จࣈྻૢ࡞
    Objective-Cɿେมͦ͏
    Rubyɿڧྗͳϝιου͕๛෋

    View full-size slide

  15. Ruby vs Objective-Cͦͷ̐
    Ϧςϥϧදه
    Objective-CɿਐԽͯ͠Δʂ
    Rubyɿγϯϓϧ

    View full-size slide

  16. ݴޠൺֱ·ͱΊʢྑ͍ॴʣ
    Objective-C
    ੩తͳܕνΣοΫ
    ೔ʑਐԽͯ͠ྑ͘ͳͬͯΔ
    Ruby
    γϯϓϧͳϧʔϧͰϝϞϦ؅ཧͰ͖Δ
    CRuby༝དྷͷڧྗͳϝλϓϩɾ૊ΈࠐΈͷϝιου

    View full-size slide

  17. Objective-Cͷ։ൃ؀ڥ
    Xcode
    ิ׬όονϦ
    InterfaceBuilder / StoryBoard
    breakpoint / LLDB
    ׬੒౓ߴ͍ͱΑ͘ฉ͖·͢
    ʢ͋·Γ࢖ͬͯͳ͍Ͱ͢...ʣ

    View full-size slide

  18. RubyMotionͷ։ൃ؀ڥ
    ࣗ༝ʹΤσΟλબ୒
    emacsͳΒmotion-mode.elͰิ׬ͱ͔͍Ζ͍Ζग़དྷΔ
    RubyMineʢIDEʣͰϒϨʔΫϙΠϯτଧͯΔ
    γΣϧ
    rakeʢRuby൛makeʣͰϏϧυ
    Interactive DebuggerʢRubyMotionͷREPLʣ
    guardʢϑΝΠϧมߋݕ஌gemʣͰࣗಈςετ
    ib ͱ͍͏gemΛ࢖͏ͱInterfaceBuilder΋࢖͑Δʂ

    View full-size slide

  19. ҆৺ײ
    Objective-C
    ຊՈͷ։ൃ؀ڥ
    CocoaPodsͰίʔυ࠶ར༻
    ࠔͬͨͱ͖ʹ৘ใଟ͍
    RubyMotion
    ຊՈͰ͸ͳ͍΋ͷͷiOSͷΞοϓσʔτʹ͸ଈ೔ରԠ
    CocoaPods΋ʢRubyMotionઐ༻ͷʣRubygems΋࢖͑Δ
    ϝΠϯ։ൃऀʹ೔ຊਓʢ@watson1978͞Μʣ

    View full-size slide

  20. ←WWDC։࠵தͷ
    2013-06-12

    View full-size slide

  21. ҆৺ײʹ͍ͭͯͷॴײ
    Objective-Cͷ΄͏͕ѹ౗తͳ҆৺ײ͋Δͱࢥ͏
    RubyMotionΛ࢖͓͏ͱͨ࣌͠͸ͦΕͳΓʹࣗ෼͔Β৘ใ
    ΛूΊΔ౒ྗΛ͠ͳ͍ͱ͍͚ͳ͍
    ͨͩɺجຊతʹࠔͬͨΒObjective-CͷίʔυΛϕλҠ২
    Ͱ͖ΔͷͰͦΜͳʹࠔΒͳ͍
    ຊ౰ʹࠔͬͨΒαϙʔτ͔@watson1978͞Μʹ
    ࣭໰ͯ͠ΈΔ

    View full-size slide

  22. ࠓ೔ͷ࿩୊
    RubyMotionͱ͸ ✔
    ࣗݾ঺հ ✔
    RubyMotion vs Titanium mobile/Phone Gap ✔
    RubyMotion vs Objective-C ✔
    RubyMotionʹΑΔiOS։ൃͷՄೳੑ
    ·ͱΊ

    View full-size slide

  23. RubyMotionͷՄೳੑ̍
    ඇৗʹ؆ܿͳίʔυΛॻ͘͜ͱ͕ग़དྷΔ
    ίʔυྔ͕ݮΕ͹ϝϯςφϯείετ΋ݮΔ
    ࠶ར༻ੑߴ·Δ
    UIΛDSLͰએݴతʹίʔυΛॻ͘ελΠϧʁ
    ͦͷͨΊʹύϑΥʔϚϯε͸एׯ٘ਜ਼ʁ

    View full-size slide

  24. NSUserDefaults

    View full-size slide

  25. RubyMotionͷՄೳੑ̎
    αʔόʔαΠυͱͷ૬ੑ͕ྑ͍ʁ
    Railsͱ͔Sinatraͱ͔ಉ͡ݴޠͰॻ͚Δ
    motion-resource gem͸ActiveRecordͱಉ͡Α͏ͳ
    I/FͰRESTfulAPIͱͷ௨৴͕ॻ͚Δ
    Railsଆ΋APIΛॻͨ͘ΊͷϥΠϒϥϦ͕੔͍ͬͯ
    ΔͷͰׂͱ؆୯ʹαʔόʔॻ͚Δ

    View full-size slide

  26. Modelఆٛ
    ௨৴ॲཧ

    View full-size slide

  27. ࠓ೔ͷ࿩୊
    RubyMotionͱ͸ ✔
    ࣗݾ঺հ ✔
    RubyMotion vs Titanium mobile/Phone Gap ✔
    RubyMotion vs Objective-C ✔
    RubyMotionʹΑΔiOS։ൃͷՄೳੑ ✔
    ·ͱΊ

    View full-size slide

  28. ·ͱΊ
    RubyMotion͸iOS։ൃʹ͓͚Δબ୒ࢶͷҰͭʂʂ
    ͍Ζ͍Ζ͋Δ͚ͲͦΕͧΕదࡐదॴʂ
    ίʔυ͕؆ܿʹॻ͚ΔͷͰϓϩτλΠϓ
    ࡞Γ΍͍͢ͷͰ͸ʂ
    ޷͖ͦ͜΋ͷͷ্खͳΕʂʂʂʂʂͰؤுΔ

    View full-size slide

  29. ͦΜͳ͜ΜͳͰ

    View full-size slide

  30. ࡞ͬͨʂʂʂʂ
    Shiori
    Shiori is a bookmark manager for github.
    http://github.com/ainame/Shiori
    ࢖ͬͨgem
    BubbleWrap
    ProMotion
    NanoStoreInMotion (NanoStore from cocoapods)

    View full-size slide

  31. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·͢

    View full-size slide

  32. ࢀߟࢿྉ
    RubyMotion - Ruby for iOS and OS X
    http://www.rubymotion.com/
    ࣮ફRubyMotion // Speaker Deck
    https://speakerdeck.com/naoya/shi-jian-rubymotion
    Titanium Mobile ʙຊ౰ʹ͋ͬͨ͜Θ͍࿩ʙ
    http://www.slideshare.net/haradaatsea4/titanium-mobile-16371136
    PhoneGapͰֶͿϚϧνεΫϦʔϯରԠϋΠϒϦουΞϓϦ։ൃ - ୈ1ճ
    http://itpro.nikkeibp.co.jp/article/COLUMN/20121212/443628/
    RubyMotion Metaprogramming | Clay Allsopp
    http://clayallsopp.com/posts/rubymotion-metaprogramming/

    View full-size slide