Successfully reported this slideshow.
Your SlideShare is downloading. ×

Xamarin.Forms (MVP ComCamp 2015)

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad

Check these out next

1 of 99 Ad

Xamarin.Forms (MVP ComCamp 2015)

Download to read offline

Introduction to Xamarin.Forms,
Cross Platform Mobile App Development.

Introduction to Xamarin.Forms,
Cross Platform Mobile App Development.

Advertisement
Advertisement

More Related Content

Viewers also liked (11)

Advertisement

Similar to Xamarin.Forms (MVP ComCamp 2015) (20)

Recently uploaded (20)

Advertisement

Xamarin.Forms (MVP ComCamp 2015)

  1. 1. Xamarin.Forms로 iOS, 안드로이드앱 두 마리 토끼잡기 이길복 (주) 바이트코드랩 이사 Microsoft MVP
  2. 2. http://1drv.ms/1BGxndp
  3. 3. 이길복 (Gilbok Lee) •  현재는 (주)바이트코드랩 이사 전에는 (주)휴즈플로우 CTO •  Microsoft MVP 7년 •  Expression Blend(2008~2009) → Silverlight(2010~2012) → ClientApp Dev(2013) → Windo ws Platform Development(2014) •  C#으로 하는 건 뭐든 좋아! •  Silverlight •  WPF •  Windows Phone •  Windows Store App •  Unity •  Xamarin
  4. 4. 바이트코드랩? •  “뭐! 게임에 카카오톡을 붙였더니 서버가 한 시간도 못 버티고 죽는다고??!” •  모바일 게임서버, Hive5에서 시작하세요. •  Hive5 SDK •  (REST API) •  유니티 3D •  Unreal (개발중)
  5. 5. 목차 1.  Xamarin 인포그래픽 2.  Xamarin의 시대적 사명 3.  Xamarin 개발환경 4.  Xamarin.Forms  헬로월드 5.  Xamarin.Forms 개요 6.  PCL(Portable Class Library) 7.  Shared Project 8.  Navigation 9.  다국어지원 10. IPlatformDependent 11. More Xamarin (Windows Phone, Mac OS, Component Store)
  6. 6. Xamarin 인포그래픽 http://goo.gl/q63jY3
  7. 7. Xamarin 시대적 사명
  8. 8. 일타쌍피의 정신계승: 크로스플랫폼 사업가의 니즈 관리자의 니즈 개발자의 니즈
  9. 9. 여러 모바일 플랫폼 앱들을 단 하나의 C#언어로 통일. 오! LINQ!
  10. 10. 플랫폼 간 코드를 공유 - 비즈니스로직: PCL - 리소스: SharedProject
  11. 11. 플랫폼 간 코드를 공유 - UI & 워크플로우: Xamarin.For ms !
  12. 12. 혹시 Visual Studio를 사용한다면, 최강의 인텔리센스, Resharper 등 개발자 경험 그대로~
  13. 13. 혹시 윈도우폰/윈도우스토어 앱을 개발해 놓은 코드가 있다면, 재활용할 수 있을지 몰라…
  14. 14. 혹시 클라우드서비스 중 애저를 좋아 한다면, Windows Azure Compone nt를 쓰면 되고!
  15. 15. Xamarin 개발환경 구축하기
  16. 16. 원클릭 설치 •  http://xamarin.com 구석구석 Download Now 버튼
  17. 17. Main IDE #1: Xamarin Studio
  18. 18. Main IDE #2: Visual Studio
  19. 19. 시간절약합시다 •  Visual Studio 2013 Update 3 •  Nuget Package Manager (2.3 이상) 업데이트 필수 •  [Tools ­– Extensions and Updates ­– Online Update]
  20. 20. 요구사항 •  Mac •  Mac OS Mountain Lion 이상 •  XCode(iOS SDK 함께 깔림) •  Windows •  Windows 7 이상 •  Visual Studio 2010 Professional 이상 •  Express Edition은 안 되요. (Add-ins 기능 미지원) •  없으면 Xamarin Studio 쓰세요!
  21. 21. AOT Compiler가 네이티브앱 생성 iOS API 100% 지원 iOS 5부터 현재까지 same-day shipping기존 Objective C 코드 호출가능
  22. 22. JIT Compilation -> Native APK 기존 Java 코드 호출가능 Android API 100% 지원 ICS부터 현재까지 same-day shipping
  23. 23. 맥이 없어도 되나? •  Sorry, 그건 아님.
  24. 24. Xamarin.iOS Build Host
  25. 25. Xamarin.iOS Build Host : Mac
  26. 26. 특이사항 •  보통은 기다리다 지쳐 IP 입력수동연결! •  윈도우/맥 양쪽에 설치된 Xamarin 버전이 일치해야함! •  실패하면 진단
  27. 27. 안드로이드 에뮬레이터: 지니모션
  28. 28. Nuget & Component Store
  29. 29. Xamarin.Forms 헬로월드 코드리뷰
  30. 30. Xamarin.Forms 개요 Overview
  31. 31. Xamarin.Forms •  하나의 UI 코드로 여러 플랫폼을 동시에! •  XAML Controls임! •  그런데 미안해! 알고있는 그 XAML 아님. •  즉, 고대부터 존재한 XAML Designer와 호환되지 않음. •  MVVM과 데이터바인딩! •  애니메이션! •  애니메이션과 async/await
  32. 32. Xamarin.Forms
  33. 33. Pages
  34. 34. Layouts
  35. 35. Controls
  36. 36. PCL을 소개합니다. (Portable Class Library)
  37. 37. PCL은 멀티플랫폼을 target하기 위해 만 들어진 클래스 라이브러리. 다시 컴파일 하는 일 없이 다양한 .NET 플 랫폼 위에서 사용될 수 있는 어셈블리를 만 들어내는 클래스 라이브러리
  38. 38. System.IO네임스페이스 136개 클래스 중 40 in Xamarin.iOS and Xamarin.Android 14 in PCL
  39. 39. 플랫폼마다 지원하는 BCL 범위 다름 BCL = .NET Base Class Library
  40. 40. 아… 진짜 사랑해 LINQ
  41. 41. 장점(pros) •  중앙집중식 코드 공유 •  다른 라이브러리들 사용하면서, 한 프로젝트에 코드 작성하고 테스트 가능 •  리팩토링 작업이 전역적으로 영향을 미칠 수 있음 •  PCL라이브러리와 각각의 플랫폼 앱 프로젝트를 동시에 수정하는 것이 가능 •  솔루션 내의 다른 프로젝트에 아주 쉽게 참조추가 •  출력 어셈블리를 공유할 수 있음
  42. 42. 단점(cons) •  서로서로 공통인 것만 인정해 주기 때문에 특정 플랫폼 타는 라이브러리 는 참조 불가. 예를 들어, Community.CsharpSqlite.WP7 따위 •  MonoTouch()와 Mono for Android가 동시에 지원하고 있지 않은 클 래스는 포함하고 있지 않음.
  43. 43. Shared Project를 소개합니다
  44. 44. 이미지, 코드, 미디어 파일을 공유. 일단 SharedProject에 어떤 파일을 넣으면 모든 플랫폼에서 공유함.
  45. 45. Add as a link 기억하세요? 파일 링킹과 유사한 컨셉.
  46. 46. 코드의 경우 조건부 컴파일 가능. 아이폰, 안드로이드폰 코드 섞어 놓고 빌드 설정으로 제어가능. #if __Android__
  47. 47. GitHub에서 Tasky 프로젝트 https://github.com/xamarin/mobile-samples/tree/mas ter/Tasky
  48. 48. Xamarin Studio 5 Visual Studio 2013 Update 2 부터 지원
  49. 49. Navigation
  50. 50. Page A Page B await this.Navigation.PushModalAsync(signInPage); await this.Navigation.PopModalAsync(); 다른 페이지 위에 Modal로 열 때: 닫을 때: await this.Navigation.PushAsync(eventDetailPage); await this.Navigation.PopAsync(); 다른 페이지로 이동할 때: 돌아올 때:
  51. 51. 다국어지원 Localization
  52. 52. 다국어 리소스준비 Country Code ISO 1366
  53. 53. Code에서 사용하기
  54. 54. XAML에서 사용하기 STEP1 •  TranslateExtension.cs 구현 •  Xamarin.Forms Sample에 들어있음 •  https://github.com/xamarin/xamarin-forms-samples/blob/master/ UsingResxLocalization/UsingResxLocalization/PagesXaml/TranslateE xtension.cs
  55. 55. XAML에서 사용하기 STEP2 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ServicePointPush.SignInPage" xmlns:local="clr-namespace:ServicePointPush;assembly=ServicePointPush" xmlns:i18n="clr-namespace:ServicePointPush;assembly=ServicePointPush"> <StackLayout Padding="20" Orientation="Vertical"> <Entry x:Name="UserIdText" Placeholder="{i18n:Translate View_SignIn_PlaceHolder_UserId}" /> <Entry x:Name="PasswordBox" IsPassword="true" Placeholder="{i18n:Translate View_SignIn_PlaceHolder_UserPw}" /> </StackLayout> </ContentPage>
  56. 56. IPlatformDependent Interface for native feature support
  57. 57. 플랫폼 의존성을 가진 기능 지원하는 방법 •  SQLite •  Notification •  UUID얻기 •  OS의 언어설정 얻기 •  Camera 등 하드웨어 관련
  58. 58. Nuget Package Manager
  59. 59. SQLite.NET 이용하기 •  Nuget Package Manager로 •  PCL 프로젝트에 SQLite.Net PCL 추가 •  iOS 프로젝트에 SQLite.Net PCL과 SQLite.Net PCL ­– XamarinIOS Platform 추가 •  Android 프로젝트에 SQLite.Net PCL과 SQLite.Net PCL ­– XamarinAndroid Platform 추가 PCL Android iOS
  60. 60. PCL에 ISQLite 추가 namespace ServicePointPush { public interface ISQLite { SQLiteConnection GetConnection(); bool ExistsTable<T>(SQLiteConnection conn); } }
  61. 61. iOS 프로젝트에 ISQLite 구현 [assembly: Dependency(typeof(SQLiteiOS))] namespace ServicePointPush.iOS { public class SQLiteiOS : ISQLite { public SQLiteiOS() { } public SQLite.Net.SQLiteConnection GetConnection() { var sqliteFilename = AppDb.DbFileName; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath, sqliteFilename); var plat = new SQLitePlatformIOS(); var conn = new SQLiteConnection(plat, path); return conn; } public bool ExistsTable<T>(SQLiteConnection conn) { return conn.ExistsTable<T>(); } } }
  62. 62. Android 프로젝트에 ISQLite 구현 [assembly: Dependency(typeof (SQLiteAndroid))] namespace ServicePointPush.Droid { public class SQLiteAndroid : ISQLite { public SQLiteAndroid () {} public SQLite.Net.SQLiteConnection GetConnection () { var sqliteFilename = AppDb.DbFileName; string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); var path = Path.Combine(documentsPath, sqliteFilename); var plat = new SQLitePlatformAndroid(); var conn = new SQLiteConnection(plat, path); return conn; } public bool ExistsTable<T>(SQLiteConnection conn) { return conn.ExistsTable<T>(); } } }
  63. 63. 사용할 땐 var sqlite = DependencyService.Get<ISQLite>(); if (sqlite == null) throw new NullReferenceException("sqlite should not be null"); _conn = sqlite.GetConnection(); if (sqlite.ExistsTable<NotificationData>(_conn) == false) { _conn.CreateTable<NotificationData>(); }
  64. 64. More Xamarin
  65. 65. More •  Google Wear, Google Glass •  Windows Phone •  Windows Store App
  66. 66. 자기주도학습 시작점 http://developer.xamarin.com
  67. 67. 무료 C# 티셔츠!
  68. 68. https://xamarin.com/c-sharp-shirt
  69. 69. Contact gilbok@live.com
  70. 70. 감사합니다.

×