Xamarin iOS

0b26590a0a8b0f1da140ed5de9b68379?s=47 USAMI Kosuke
November 16, 2018

Xamarin iOS

0b26590a0a8b0f1da140ed5de9b68379?s=128

USAMI Kosuke

November 16, 2018
Tweet

Transcript

  1. Xamarin Λ࢖ͬͨ iOS ΞϓϦ։ൃͷݱ৔͔Β Ӊࠤݟެี Fenrir Inc.

  2. Xamarin ͱ͸

  3. Xamarin ͱ͸ • ෳ਺ͷϓϥοτϑΥʔϜʹରԠͨ͠ΞϓϦ։ൃ؀ڥ • iOS / Android / ...

    • .NET / Mono ϕʔε • C# Ͱ͢΂ͯͷίʔυ͕ॻ͚Δ • ʢC# Ҏ֎ʹ F# ΋࢖͑Δʣ
  4. ωΠςΟϒΞϓϦ • ֤ OS ͷωΠςΟϒ API ͕࢖͑Δ • ωΠςΟϒ API

    ΁ͷ C# όΠϯσΟϯά • ֤ OS ͷωΠςΟϒ UI ͕࢖͑Δ • ͦΕҎ֎ʹ Xamarin.Forms ͱ͍͏બ୒ࢶ΋͋Δ • ֤ OS ͷωΠςΟϒΞϓϦ͕ϏϧυͰ͖Δ
  5. ϓϥοτϑΥʔϜؒͷίʔυڞ௨Խ

  6. ࢖༻࣮੷

  7. ࣮ࡍʹ࢖ͬͯΈͯ

  8. ࣮ࡍʹ iOS ΞϓϦ։ൃͰ࢖ͬͯΈͯ • IDE • Storyboard • C#

  9. IDE ˍ Storyboard

  10. ։ൃ؀ڥʢIDEʣ • બ୒ࢶ • Visual Studio for Mac • RiderʢJetBrains

    ੡ IDEʣ • Windows + Visual Studio
  11. ࣮ࡍͷ؀ڥ • Visual Studio for Mac Ͱͻͱͱ͓Γͷ͜ͱ͕Ͱ͖Δ • ίʔσΟϯά͸ Rider

    ΍ Windows ্ͷ VS ͷํָ͕ • ͨͩɺσόοά΍ Storyboard ฤूͳͲ͸ෆ͕҆͋Δ • ซ༻͸໘౗ͳͷͰɺ݁ہ VS for Mac Ͱશ෦΍͍ͬͯΔ
  12. Xamarin.iOS ͱ Storyboard • Storyboard ্ʹ UIViewController Λஔ͘৔߹

  13. Storyboard ฤू࣌ͷ໰୊ • VS for Mac Ͱ Storyboard Λฤू͢Δ৔߹ •

    ⭕ ৽͍͠ class ໊ΛೖΕΔͱɺclass ϑΝΠϧΛੜ੒ • ⭕ .designer.cs ϑΝΠϧͱͷ࿈ܞ • ❌ View ͷ഑ஔ่͕ΕΔ͜ͱ͕͋Δ • ❌ Auto Layout ͷ੍໿͕উखʹมΘΔ͜ͱ͕͋Δ
  14. VS for Mac ͱ Xcode ͷซ༻ • ࠷ॳͷ࡞੒΍ .designer.cs ࿈ܞ͸

    VS for Mac • View ഑ஔ΍ϨΠΞ΢τௐ੔͸ Xcodeʢ݁ہɺซ༻ঢ়ଶʣ
  15. ̘ˌ

  16. ̘ˌ • Swift / Kotlin ʹൺ΂Ε͹ݹ͍͕ɺݱࡏ΋ਐԽ͍ͯ͠Δ • ඪ४ͷݴޠػೳ͕༏Ε͍ͯΔ • namespace

    • event • async / await • Reactive • ͳͲ
  17. event class Hoge { public event EventHandler HogeEvent; HogeEvent.Invoke(); //

    ΠϕϯτൃՐʢ಺ଆ͔ΒͷΈʣ } var hoge = new Hoge(); hoge.HogeEvent += ... // ΠϕϯτϋϯυϦϯάॲཧ
  18. async / await async Task<bool> HogeAsync() { // Կ͔ͷඇಉظॲཧ }

    var result1 = Hoge1(); var result = await HogeAsync(); // ඇಉظॲཧ͕ऴΘΔͷΛ଴ͭ var result2 = Hoge2();
  19. await ͰΞϥʔτͷϘλϯԡԼ଴ͪ var tcs = new TaskCompletionSource<bool>(); var alert =

    UIAlertController.Create(title, message, style); alert.AddAction(UIAlertAction.Create(name, style, action => { tcs.SetResult(true); // ϘλϯͷΞΫγϣϯͰ SetResult })); PresentViewController(alert, true, null); var result = await tcs.Task; // SetResult Λ଴ͭ
  20. Reactive Extensions • ͍ΘΏΔ Rx • .NET ൃ঵ͷ΋ͷ͕֤ݴޠʹ޿·͍ͬͯΔ • Θ͟Θ͟ϥΠϒϥϦΛೖΕͣͱ΋ɺඪ४ͰରԠ͍ͯ͠Δͷ͕ڧ

    Έ • ҎԼͷϥΠϒϥϦΛೖΕΔͱΑΓศར • ReactiveProperty • ReactiveCommand
  21. ·ͱΊ

  22. ·ͱΊ • IDE ͸ Visual Studio for Mac • Storyboard

    ฤू͸ Xcode • ซ༻ঢ়ଶʹͳΔͷ͸΍΍໘౗ • C# ͸݁ߏศར