Pro Yearly is on sale from $80 to $50! »

JXUG Conference 2 West

0b26590a0a8b0f1da140ed5de9b68379?s=47 USAMI Kosuke
November 08, 2014

JXUG Conference 2 West

iOS エンジニアが Xamarin を始めた話

0b26590a0a8b0f1da140ed5de9b68379?s=128

USAMI Kosuke

November 08, 2014
Tweet

Transcript

  1. iOS ΤϯδχΞ͕ Xamarin Λ࢝Ίͨ࿩ Ӊࠤݟ ެี

  2. About Me 4 Ӊࠤݟެีʢtwitter : @usamik26ʣ 4 ϑΣϯϦϧגࣜձࣾ ڞಉ։ൃ෦ 4

    iOS ΞϓϦ։ൃ 4 ϓϥΠϕʔτ 4 OS X ΞϓϦ։ൃ : CotEditorʢςΩετΤσΟλʣ
  3. Xamarin ྺ 4 ๻͸൒೥΄Ͳલ͔Β։࢝ 4 ࣾ಺ʹ͸࣮຿ܦݧ͕͋Δৄ͍͠ਓ͕طʹԿਓ͔͍ͨ 4 ࣮຿Ͱ Xamarin +

    MvvmCross Λ࢖༻ 4 MvvmCross github ʹ pull request Λૹͬͨ͜ͱ΋
  4. ͳͥ Xamarin Λ΍Ζ͏ͱ ࢥ͔ͬͨ

  5. C# ͕࢖͑Δʁ 4 εϚϗΞϓϦ։ൃ͕ C# ͰͰ͖Δ 4 ɾɾɾ͜Ε͸๻ʹ͸ແؔ܎ 4 iOS

    ΞϓϦ։ൃ͸Ͱ͖Δ 4 C# / .NET ͸͋·Γ஌Βͳ͍
  6. ΫϩεϓϥοτϑΥʔϜ։ൃ 4 iOS / Android ΞϓϦ։ൃ͕ڞ௨ԽͰ͖Δ 4 ͜Ε͸େ͖ͳϝϦοτ 4 ࣮຿্ɺ྆ํͷΞϓϦ։ൃ͕ฒߦͯ͠ߦΘΕΔ͜ͱ͸

    ଟ͍ 4 iOS ΞϓϦ։ൃऀͱ Android ΞϓϦ։ൃऀͱͰɺΞ ϓϦͷ࢓༷ೝࣝҧ͍Λ๷͙ͷ͸Ҋ֎͍ͨ΁Μ
  7. ଞͷπʔϧͱͷൺֱ (1) 4 ଞͷπʔϧͰ͸ɺ֤ϓϥοτϑΥʔϜ։ൃͷྑ͞Λੜ͔ͤ ͳ͍͜ͱ͕ଟ͍ 4 Xamarin ͸ωΠςΟϒ SDK Λੜ͔͍ͯ͠Δ

    4 ͞Βʹ࠷৽؀ڥ΁ͷରԠ΋ૣ͍
  8. ଞͷπʔϧͱͷൺֱ (2) 4 ଞͷπʔϧͰ͸ɺϓϥοτϑΥʔϜʹ͋ΘͤͨڍಈΛͤ͞ Δͷ͕Ҋ֎೉͍͠ 4 iOS ΞϓϦ͕ Android ΞϓϦͬΆ͍ಈ͖Λͨ͠Γɺ

    Android ΞϓϦ͕ iOS ΞϓϦͬΆ͍ಈ͖Λͨ͠Γ͢Δ ͷ͸ෆࣗવ
  9. MVVM 4 εϚϗΞϓϦ։ൃ͕ MVVM ͰͰ͖Δ 4 ݸਓతʹܾఆଧͱͳͬͨͷ͸͜ͷ఺ 4 iOS ΞϓϦ։ൃͰ͸

    ReactiveCocoa Λ࢖͏ͱ͍͏બ ୒͕͋Δ͕ɺ·ͩϓϥΫςΟεཱ͕֬͞Ε͍ͯͳ͍ײ ͡ 4 C# / .NET จԽݍͰ͔ͭͪΘΕ͖ͯͨઃܭख๏͔ͩ ΒɺXamarin ͸૬ੑ͕Α͍
  10. ݁ہɺXamarin Λ࢝Ίͨཧ༝ ͸ɾɾɾ 4 MVVM Ͱ։ൃͰ͖Δ 4 ϏϡʔͱϩδοΫͷ෼཭ 4 ΫϩεϓϥοτϑΥʔϜ։ൃͱͷ਌࿨ੑ

  11. վΊͯ MVVM

  12. MVVM (Model - View - ViewModel) 4 View ͸ϓϥοτϑΥʔϜґଘ 4

    View ͱ ViewModel ͸ Binding Ͱ࿈ܞ 4 ViewModel / Model ͕ϩδοΫ෦෼ɺϓϥοτϑΥʔϜඇ ґଘ
  13. MVVM ͱϓϥοτϑΥʔϜͷؔ܎ 4 C# / .NET จԽݍͰ͔ͭͪΘΕ͖ͯͨ 4 ౰ॳ͸ओʹ Windows

    ϓϥοτϑΥʔϜ্ͷΈͰ࢖ΘΕͯ ͍ͨʁ 4 ͔͠͠ɺViewModel ΛϓϥοτϑΥʔϜඇґଘʹͰ͖Δͨ ΊɺΫϩεϓϥοτϑΥʔϜ։ൃͱ૬ੑ͕Α͍
  14. MVVM ͱεϚϗϓϥοτϑΥʔϜ 4 View Λ֤ϓϥοτϑΥʔϜͰ։ൃ͢Δ 4 ͜ͷͨΊɺ֤ϓϥοτϑΥʔϜͷੈք؍Λେࣄʹ͢Δ͜ͱ ͕Ͱ͖Δ 4 iOS

    Β͠͞ɺAndroid Β͠͞͸େࣄ 4 ΫϩεϓϥοτϑΥʔϜ։ൃͰͦ͜ MVVM ͷྑ͕͞ੜ͖Δ ͷͰ͸ɺͱউखʹࢥ͍ͬͯΔ
  15. ࣮ࡍʹ Xamarin.iOS Λ࢖ ͬͯΈΔ

  16. ·ͣ࠷ॳʹ 4 C# Θ͔Βͳ͍ 4 ৮ͬͨ͜ͱ͸͚͋ͬͨͲ C# 1.0 / 2.0

    ͘Β͍ 4 ͱΓ͋͑ͣجຊతͳจ๏Λ͞Βͬͱݟͯɺ͋ͱ͸࣮຿ͱ ฒߦͰษڧ
  17. C# ʹ׳Εͯ͘Δͱ 4 ݴޠ͕ҧ͏͚ͩͰࠜͬ͜ͷϑϨʔϜϫʔΫ͸ಉ͡ 4 ϑϨʔϜϫʔΫؔ࿈͸͜Ε·Ͱͷ஌͕ࣝ΄΅ͦͷ··௨ ༻͢Δ 4 ίʔυ͕ॻ͖΍͍͢͜ͱʹؾͮ͘ 4

    ݸਓతʹ͸ϥϜμࣜͱ͔ LINQ ͱ͔޷͖
  18. Α͘΍Δϛε 4 Xamarin Studio ্Ͱ Objective-C ͷίʔυΛॻ͍ͯ͠· ͏ 4 [UIImage

    ima ͘Β͍·Ͱॻ͍ͯɺ͋Εิ׬͞Εͳ͍ͳ ͋ɺͱ͔ 4 ϝιου໊͕Θ͔Βͳ͘ͳΔ 4 ໋໊نଇ͕ Objective-C ෩ͱ C# ෩Ͱ͸ҧ͍ͬͯΔ
  19. Α͘΍Δϛεͷٯύλʔϯ 4 ׳Εͯ͘Δͱٯύλʔϯ΋΍Β͔ͨ͠ 4 Xcode ্Ͱ UIImage image = ͱ͔ॻ͍͍ͯͯɺͳΜͰ

    ϏϧυΤϥʔͳͷ͔ͳ͋ɺͱ͔ ʢΞελϦεΫΛ๨ΕΔʣ
  20. υΩϡϝϯτʁ 4 MonoDoc ͷυΩϡϝϯτ͕ͪΐͬͱ৘ใෆ଍ʁ 4 ରԠ͢Δϝιουͷ Xcode υΩϡϝϯτΛࢀরͨ͠Γ 4 Xamarin

    ͷαΠτʹ͸͍Ζ͍ΖυΩϡϝϯτ͕͋ͬͨ
  21. ศརΫϥε 4 UITableViewSource 4 UITableViewDataSource ͱ UITableViewDelegate ͷ ౷߹ 4

    ͍ͭ͜Β͸͍͍ͩͨ͋Θͤͯ࢖͏͜ͱ͕ଟ͍ͷͰͪΐͬ ͱָʹͳΔ 4 UICollectionViewSource ΋͋Δ
  22. Storyboard 4 ໊લೖΕΔ͚ͩͰউखʹϓϩύςΟ௥Ճͯ͘͠ΕΔͱ͔ศ ར 4 μϒϧΫϦοΫͰΞΫγϣϯੜ੒Ͱ͖Δͱ͔ศར 4 Xcode ʹ͸͜͏͍͏ͷͳ͔ͬͨͳɾɾɾ

  23. AutoLayout 4 Constraint ͷ௥Ճͷ࢓ํ͕ͪΐͬͱҧ͏ 4 ׳ΕΔͱָ 4 Constraint μϒϧΫϦοΫͰฤूͰ͖Δ

  24. API 100% ରԠ 4 AVFoundation ͱ͔࢖͍͍ͨΜ͚ͩͲɾɾɾ 4 ͱࢥͬͨΒɺԿʹ΋ߟ͑ͳͯ͘΋࢖͑ͨ using MonoTouch.AVFoundation;

    var session = new AVCaptureSession(); ...
  25. MVVM ͷಋೖ

  26. MvvmCross 4 ΍Γํ͸͍Ζ͍Ζ͋Δ͚Ͳɺ୲౰ϓϩδΣΫτͰ͸ MvvmCross Λ࠾༻ 4 ࣾ಺ʹઌۦऀ͕ଟ͍ 4 ΦʔϓϯιʔεͳͷͰͳΜͳΒमਖ਼͢Δʢ࣮ࡍͨ͠ʣ

  27. ͜Ε΋࠷ॳʹ 4 MVVM Θ͔Βͳ͍ 4 ࣮ࡍʹίʔυॻ͍ͯΈΔͱ࠷ॳ͸Ҋ֎ॻ͚ͳͯ͘ͱ·Ͳ ͏ 4 ͳΜ͔ख଍റΒΕͯΔײ͕͋Δ

  28. MVVM ʹ׳Εͯ͘Δͱ 4 ٯʹͳΜͰ΋ MVVM ʹͨ͘͠ͳΔ 4 Xamarin ͳ͠Ͱ iOS

    ΞϓϦʁ ͩͬͨΒ ReactiveCocoa ࢖͓͏͔ʁ
  29. ศརΫϥε 4 Binding Λָʹͯ͘͠ΕΔ 4 MvxTableViewCell 4 MvxImageView 4 URL

    ౉ͨ͠Βউखʹը૾औಘͯ͘͠ΕΔͱ͔
  30. MvvmCross ϓϩδΣΫτߏ੒ 4 Core ϓϩδΣΫτ : Model / ViewModel 4

    Touch ϓϩδΣΫτ : iOS View 4 Droid ϓϩδΣΫτ : Android View
  31. Α͘΍Δʢʁʣϛε 4 MonoTouch ͷΫϥε͕࢖͑ͳ͍ɺͱࢥͬͨΒ ViewModel ͩͬͨ 4 ViewModel : Core

    ϓϩδΣΫτ 4 View : Touch ϓϩδΣΫτ
  32. Α͘΍Δʢʁʣϛε (2) 4 View ʹ͕Γ͕Γ࣮૷ͯ͠͠·͏ɾɾɾ 4 ςϯύ͖ͬͯͨͱ͖ʹ΍Β͔͢ 4 MVVM ͷྑ͞Λ୆ແ͠ʹ͢Δ

  33. ϓϥάΠϯ 4 ϓϥοτϑΥʔϜґଘͷػೳΛ ViewModel ͔Β࢖͍͍ͨ 4 ΠϯλʔϑΣʔεఆٛ͸ Core ϓϩδΣΫτ 4

    ࣮૷͸ Touch ϓϩδΣΫτ
  34. ϓϥάΠϯͷΑ͋͠͠ 4 ਖ਼௚Θ͟Θ͟ϓϥάΠϯԽ͢Δͷ͸໘౗͍͘͞ 4 ͚ͩͲͦ͏͠ͳ͍ͱ View ʹ͕Γ͕Γॻ͘͜ͱʹͳΔ 4 Ұ౓ॻ͍ͯ͠·͑͹͖ͬ͢Γͨ͠ίʔυ͕ॻ͚Δ

  35. ݒ೦఺ 4 64ϏοτରԠɾɾɾʁ 4 Xamarin ͷ Unified ͷ࢓૊Έʹ MvvmCross ͕ରԠ͠

    ͯ͘Εͳ͍ͱͭΒ͍ 4 Forms ʹҠߦͨ͠΄͏͕͍͍ͷʁ 4 Forms Ͱ iOS / Android ͦΕͧΕͷੈք؍ΛେࣄʹͰ ͖ΔͳΒ
  36. ·ͱΊ

  37. ·ͱΊ 4 Xamarin Ͱ C# / MVVM Ͱ iOS ΞϓϦ࡞Δͷؾ࣋ͪΑ͘

    ͳ͖ͬͯͨ 4 ͍·ઈࢍ Xamarin Ҋ݅๩͍͠ͷͰࢮͳͳ͍ఔ౓ʹ͕Μ͹ Δ