Top Banner
Xamarin の特徴と開発手法概要 2016/9/7 2016年9月定例会「クロスプラット フォーム開発最前線」 田淵義人@エクセルソフト Twitter: @ytabuchi facebook: ytabuchi.xlsoft
29

Xamarin の特徴と開発手法概要

Jan 07, 2017

Download

Software

Yoshito Tabuchi
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Xamarin の特徴と開発手法概要

Xamarin の特徴と開発手法概要

2016/9/7 2016年9月定例会「クロスプラットフォーム開発最前線」

田淵義人@エクセルソフト

Twitter: @ytabuchi

facebook: ytabuchi.xlsoft

Page 2: Xamarin の特徴と開発手法概要

自己紹介

Xamarin コミュニティエバンジェリスト

2016年4月 Microsoft MVP Visual Studio and Development Technologies 受賞

Build Insider, マイナビニュース

.NET開発テクノロジ入門2016年版 (Xamarinの章)

Japan Xamarin User Group (ジェイザグ) 主催

Twitter: @ytabuchi

facebook: ytabuchi.xlsoft

Blog: Xamarin 日本語情報

2

Page 3: Xamarin の特徴と開発手法概要

ゴール

Xamarin の仕組み・開発手法を理解してもらう

面白そうだなと感じてもらう

Page 4: Xamarin の特徴と開発手法概要

事例

Page 5: Xamarin の特徴と開発手法概要

Sakenomy

http://www.xlsoft.com/jp/products/xamarin/apps_sakenomy.html

5

Page 6: Xamarin の特徴と開発手法概要

NHK 紅白

http://biz.fenrir-inc.com/application_development/casestudy_app/nhk_kouhaku.html

6

Page 7: Xamarin の特徴と開発手法概要

アジェンダ

Xamarin 概要

Xamarin ネイティブでの開発

Xamarin.Forms での開発

まとめ

Page 8: Xamarin の特徴と開発手法概要

アジェンダ

Xamarin 概要

Xamarin ネイティブでの開発

Xamarin.Forms での開発

まとめ

Page 9: Xamarin の特徴と開発手法概要

Xamarin (ザマリン)

9

Page 10: Xamarin の特徴と開発手法概要

Xamarin

10

Page 11: Xamarin の特徴と開発手法概要

C# 6.0

11

using System.Collections.Generic;using System.IO;using System.Linq;using System.Net.Http;using Newtonsoft.Json;

button.Click += async (sender, e) =>{

using (var client = new HttpClient()){using (var reader = new StreamReader(await client.GetStreamAsync("xxx"))){

var json = await reader.ReadToEndAsync();var jsonModel = JsonConvert.DeserializeObject<List<Data>>(json).Where(x => x.Url.Contains("xamarin")).Select(x => x.Title).ToList();

}}

};

Page 12: Xamarin の特徴と開発手法概要

2つの開発手法

12

Shared C# App Logic

(PCL)

Shared XAML/C# UI Code

(Xamarin.Forms)

iOS

C# UI

Shared C# App Logic

(PCL)

Android

C# UI

Windows

C# UI

Xamarin.FormsXamarin Nativeロジックのみ共通化

UIはネイティブで個別に作りこむ

Page 13: Xamarin の特徴と開発手法概要

必要な知識

13

プラットフォーム個別

Xamarin Native

iOS API Objective-C, Swift Xcode

Android API Java Android Studio

Windows API Visual StudioC#

API 言語 統合開発環境

iOS API Objective-C, Swift Xcode

Android API Java Android Studio

Windows API Visual StudioC#

Xamarin.Forms

iOS API

Android API

Windows API

Objective-C, Swift Xcode

Java Android Studio

Visual StudioC#Xamarin.Forms

UI toolkit

Page 14: Xamarin の特徴と開発手法概要

アジェンダ

Xamarin 概要

Xamarin ネイティブでの開発

Xamarin.Forms での開発

まとめ

Page 15: Xamarin の特徴と開発手法概要

Xamarin ネイティブ

15

iOS

C# UI

Shared C# App Logic

(PCL)

Android

C# UI

Windows

C# UI

Xamarin Nativeロジックのみ共通化

UIはネイティブで個別に作りこむ

Page 16: Xamarin の特徴と開発手法概要

Layout

16

Page 17: Xamarin の特徴と開発手法概要

Activity + Layout

17

<LinearLayout ... ><TextView ... /><EditText ... /><Button ... /><TextView ... />

</LinearLayout>

[Activity(MainLauncher = true)]public class MainActivity : Activity{

protected override void OnCreate(Bundle bundle){base.OnCreate(bundle);SetContentView(Resource.Layout.Main);

var editText = FindViewById<EditText>(Resource.Id.digitsInput);

...}...

}

Page 18: Xamarin の特徴と開発手法概要

アジェンダ

Xamarin 概要

Xamarin ネイティブでの開発

Xamarin.Forms での開発

まとめ

Page 19: Xamarin の特徴と開発手法概要

Xamarin.Forms

最大公約数

19

Shared C# App Logic

(PCL)

Shared XAML/C# UI Code

(Xamarin.Forms)

Xamarin.Forms

Page 20: Xamarin の特徴と開発手法概要

Xamarin.Forms

20

Page 21: Xamarin の特徴と開発手法概要

アジェンダ

Xamarin 概要

Xamarin ネイティブでの開発

Xamarin.Forms での開発

まとめ

Page 22: Xamarin の特徴と開発手法概要

Xamarin

22

Page 23: Xamarin の特徴と開発手法概要

2つの開発手法

23

Shared C# App Logic

(PCL)

Shared XAML/C# UI Code

(Xamarin.Forms)

iOS

C# UI

Shared C# App Logic

(PCL)

Android

C# UI

Windows

C# UI

Xamarin.FormsXamarin Nativeロジックのみ共通化

UIはネイティブで個別に作りこむ

Page 24: Xamarin の特徴と開発手法概要

興味を持ってくれた方は参考資料・サンプル

24

Page 25: Xamarin の特徴と開発手法概要

デモで使用したプロジェクト

https://github.com/ytabuchi/XamarinNative/tree/master/ListViewSample

Xamarin.Android の ListView で Item を追加、削除したい(CustomAdapter)

Xamarin.Android の ListView で Item を追加、削除したい(ArrayAdapterとSimpleListItem1)

https://github.com/ytabuchi/xamarin-forms/tree/master/XF_ListViewSample

MVVM な Xamarin.Forms プロジェクトの Model を UnitTest してみる - その1

MVVM な Xamarin.Forms プロジェクトの Model を UnitTest してみる - その2

Page 26: Xamarin の特徴と開発手法概要

ハンズオンレポジトリ

https://github.com/ytabuchi/XamarinHOL

26

Page 27: Xamarin の特徴と開発手法概要

Prebuiltサンプル

https://www.xamarin.com/prebuilt

27

Acquaint Sport Xamarin CRM My Shoppe

Page 28: Xamarin の特徴と開発手法概要

【告知】次回 JXUG

JXUGC #17 お前の Xamarin アプリを見せてみろ! -connpass

28

Page 29: Xamarin の特徴と開発手法概要

ご清聴ありがとうございます

田淵義人@エクセルソフト

Twitter: @ytabuchi

facebook: ytabuchi.xlsoft