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

Xamarin iOS

USAMI Kosuke
November 16, 2018

Xamarin iOS

USAMI Kosuke

November 16, 2018
Tweet

More Decks by USAMI Kosuke

Other Decks in Programming

Transcript

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

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

    ΁ͷ C# όΠϯσΟϯά • ֤ OS ͷωΠςΟϒ UI ͕࢖͑Δ • ͦΕҎ֎ʹ Xamarin.Forms ͱ͍͏બ୒ࢶ΋͋Δ • ֤ OS ͷωΠςΟϒΞϓϦ͕ϏϧυͰ͖Δ
  3. ࣮ࡍͷ؀ڥ • Visual Studio for Mac Ͱͻͱͱ͓Γͷ͜ͱ͕Ͱ͖Δ • ίʔσΟϯά͸ Rider

    ΍ Windows ্ͷ VS ͷํָ͕ • ͨͩɺσόοά΍ Storyboard ฤूͳͲ͸ෆ͕҆͋Δ • ซ༻͸໘౗ͳͷͰɺ݁ہ VS for Mac Ͱશ෦΍͍ͬͯΔ
  4. Storyboard ฤू࣌ͷ໰୊ • VS for Mac Ͱ Storyboard Λฤू͢Δ৔߹ •

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

    VS for Mac • View ഑ஔ΍ϨΠΞ΢τௐ੔͸ Xcodeʢ݁ہɺซ༻ঢ়ଶʣ
  6. event class Hoge { public event EventHandler HogeEvent; HogeEvent.Invoke(); //

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

    var result1 = Hoge1(); var result = await HogeAsync(); // ඇಉظॲཧ͕ऴΘΔͷΛ଴ͭ var result2 = Hoge2();
  8. 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 Λ଴ͭ
  9. ·ͱΊ • IDE ͸ Visual Studio for Mac • Storyboard

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