Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Xamarin + MvvmCross で作る iOS/Android アプリ
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Nobuhiro Ito
May 03, 2014
Programming
1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Xamarin + MvvmCross で作る iOS/Android アプリ
2014/05/03(Sat) Kyoto.なんか #kyotoasterisk
Nobuhiro Ito
May 03, 2014
More Decks by Nobuhiro Ito
See All by Nobuhiro Ito
Introduction of Aizome - 多言語対応とスタイル適用を両立する書式付き文字列ライブラリ
iseebi
0
180
Bitriseで本をビルドする / Build a book with Bitrise
iseebi
0
180
BitriseでmacOSアプリをビルドする / Build macOS apps with Bitrise
iseebi
1
890
iOS/Androidアプリ転送ツール TransporterPadの紹介
iseebi
0
6.2k
Apple Developer Enterprise Program でどこまでいけるのか
iseebi
0
820
ReactiveProperty を使ったアプリの設計に Realm Xamarin を組み合わせる
iseebi
0
680
ReactiveProperty で Xamarin アプリの作り方が変わった
iseebi
3
1.8k
600件のPull RequestからみたXamarinのはまりどころ
iseebi
3
4.4k
Yet Another Cross Platform Development
iseebi
0
4.3k
Other Decks in Programming
See All in Programming
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
260
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
430
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
190
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
270
ActionController meets Protocol Buffers
sorah
0
520
すこし踏み込む CancellationToken
htkym
2
1.7k
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
The Rails Doctrine Decade
koic
2
590
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Featured
See All Featured
Claude Code のすすめ
schroneko
67
230k
Balancing Empowerment & Direction
lara
6
1.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
270
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
2
410
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
460
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Six Lessons from altMBA
skipperchong
29
4.5k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
Transcript
Xamarin + MvvmCross で作る iOS/Androidアプリ 伊勢 シン (@iseebi) Kyoto.なんか 2014/05/03(Sat)
⾃自⼰己紹介 • 伊藤 伸裕 / 伊勢 シン – @iseebi / id:iseebi
• フェンリル株式会社 共同開発部所属 – iOS / Android / Windows 8 のアプリ開発してます • コミュニティ – スマートフォン勉強会@関⻄西 – すごいHaskell読書会 in ⼤大阪 • H本読んでます。(2週⽬目)
Xamarin 2.0 • ネイティブの iOS / Android / Mac アプリを
C# で書ける! – Windows プラットフォームを⾜足せば、だいたいのプラッ トフォームのソースをC#で書いてしまえる。
処理理を共通化できます! • C#だけで書ける=iOS/Androidで処理理を共通化できる • アプリの性質にもよるが、3割から4割くらい共通化できま す。 PCL
なぜXamarin? • C# を使うプラットフォームでは MVVM という概念念がすでに体系化されている。 – Model-View-ViewModel • クロスプラットフォーム開発で MVVM
をサポートするライブラリもすでにある – MvvmCross – QuickCross
MVVM • MVなんとかの中でもバインディングに ものすごく依存している • 移し替えのコードがバグ出やすいので、 なるべくバインディングで解決させたい (と僕は思う) http://msdn.microsoft.com/en-us/library/gg405484(v=PandP.40).aspx#sec1
%&.0
プロジェクト初期設定 • プロジェクトの初期設定 – http://www.slideshare.net/iseebi/cross-platform- development-with-xamarin-20- mvvmcross-32190450 • NuGetで導⼊入する際、下記のものも⼊入れる –
MvvmCross – MvvmCross – DownloadCache Plugin • MvvmCross.HotTuna.Plugin.DownloadCache – MvvmCross – File Plugin • MvvmCross.HotTuna.Plugin.File – Microsoft HTTP Client Libraries (Coreのみ) • Microsoft.Net.Http
はてなフォトライフへのアクセス • gistを参考に – https://gist.github.com/iseebi/492486
ViewModel の作成 • 取得したデータを出す IEnumerable をプロパ ティに出す • Start のタイミングで読み込みを⾏行行う
iOSの実装 – セルの作成 • iPhone Table View Cell を追加すると、 .cs
と .xib が⽣生成される。 • 継承元を MvxTableViewCell に変更更 • .xib にコントロールを配置し、アウトレット接続 – Xcode上で⾏行行う – UIImageView は MvxImageView にする。 URLでバインディングできるようになる。 • DelayBind を記述する
iOSの実装 - ViewController • MvxTableViewController にする • インナークラスで TableViewSource を作る
– コンストラクタで RegisterCellForReuse する • ViewDidLoad でバインディングを作成
Androidの実装 - ListItem • Layout を追加する • xmlns に local
を追加する – xmlns:local="http://schemas.android.com/apk/ res-auto" • 各要素に local:MvxBind を追加する – コントロール側のプロパティ ViewModel側のプロパテ ィ で記述する – ImageView は Mvx.MvxImageView にする。
Android の実装 - View • ListView のかわりに Mvx.MvxListView を使⽤用 する。
• local:MvxBind に ViewModel とのバインディン グを作成 • local:MvxItemTemplate で、使⽤用するレイアウ トを指定する
デメリット • ライセンスが⾼高い – 会社で使うと1開発者1プラットフォーム 約10万円 – チームを組むと iOS /
Android 3本ずつ=60万 (実際はディスカウント⼊入るのでもうちょっと安い) • こまかい制限もちょいちょい – 動的コンパイル必要な機能は動かない • まあ、「お⾦金金が出るならアリ」の技術… – コード共有で浮くお⾦金金でライセンスを買おう
まとめ • Xamarin と MvvmCross を使うと、 iOS / Android アプリを効率率率的に開発できます。
参考URL • 今回のソース – https://github.com/iseebi/FotolifeViewer • Qiita の Xamarin タグ
(国内のXamarin系の⼈人の Qiita 参加率率率⾼高い) – http://qiita.com/tags/xamarin • Xamarin ⽇日本語情報 (国内代理理店の⼈人のblog) – http://ytabuchi.hatenablog.com/ • Xamarin Japan グループ (facebook) – https://www.facebook.com/groups/778386365523431/ • backyard of 伊勢的新常識識 (僕のblogです) – http://iseebi.hatenablog.com/