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.
바이트코드랩?
• “뭐! 게임에 카카오톡을 붙였더니 서버가
한 시간도 못 버티고 죽는다고??!”
• 모바일 게임서버, Hive5에서 시작하세요.
• Hive5 SDK
• (REST API)
• 유니티 3D
• Unreal (개발중)
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)
19.
시간절약합시다
• Visual Studio 2013 Update 3
• Nuget Package Manager (2.3 이상) 업데이트 필수
• [Tools – Extensions and Updates – Online Update]
20.
요구사항
• Mac
• Mac OS Mountain Lion 이상
• XCode(iOS SDK 함께 깔림)
• Windows
• Windows 7 이상
• Visual Studio 2010 Professional 이상
• Express Edition은 안 되요. (Add-ins 기능 미지원)
• 없으면 Xamarin Studio 쓰세요!
21.
AOT Compiler가 네이티브앱 생성 iOS API 100% 지원
iOS 5부터 현재까지 same-day shipping기존 Objective C 코드 호출가능
22.
JIT Compilation -> Native APK
기존 Java 코드 호출가능
Android API 100% 지원
ICS부터 현재까지 same-day shipping
31.
Xamarin.Forms
• 하나의 UI 코드로 여러 플랫폼을 동시에!
• XAML Controls임!
• 그런데 미안해! 알고있는 그 XAML 아님.
• 즉, 고대부터 존재한 XAML Designer와 호환되지 않음.
• MVVM과 데이터바인딩!
• 애니메이션!
• 애니메이션과 async/await
41.
장점(pros)
• 중앙집중식 코드 공유
• 다른 라이브러리들 사용하면서, 한 프로젝트에 코드 작성하고 테스트 가능
• 리팩토링 작업이 전역적으로 영향을 미칠 수 있음
• PCL라이브러리와 각각의 플랫폼 앱 프로젝트를 동시에 수정하는 것이 가능
• 솔루션 내의 다른 프로젝트에 아주 쉽게 참조추가
• 출력 어셈블리를 공유할 수 있음
42.
단점(cons)
• 서로서로 공통인 것만 인정해 주기 때문에 특정 플랫폼 타는 라이브러리
는 참조 불가. 예를 들어, Community.CsharpSqlite.WP7 따위
• MonoTouch()와 Mono for Android가 동시에 지원하고 있지 않은 클
래스는 포함하고 있지 않음.
50.
Page A Page B
await this.Navigation.PushModalAsync(signInPage);
await this.Navigation.PopModalAsync();
다른 페이지 위에 Modal로
열 때:
닫을 때:
await this.Navigation.PushAsync(eventDetailPage);
await this.Navigation.PopAsync();
다른 페이지로
이동할 때:
돌아올 때:
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.
PCL에 ISQLite 추가
namespace ServicePointPush
{
public interface ISQLite
{
SQLiteConnection GetConnection();
bool ExistsTable<T>(SQLiteConnection conn);
}
}
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.
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.
사용할 땐
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>();
}
It appears that you have an ad-blocker running. By whitelisting SlideShare on your ad-blocker, you are supporting our community of content creators.
Hate ads?
We've updated our privacy policy.
We’ve updated our privacy policy so that we are compliant with changing global privacy regulations and to provide you with insight into the limited ways in which we use your data.
You can read the details below. By accepting, you agree to the updated privacy policy.