Infinum iOS Talks #2 - Xamarin by Ivan Đikić

Post on 16-Apr-2017

121 views 3 download

Transcript of Infinum iOS Talks #2 - Xamarin by Ivan Đikić

IVAN ĐIKIĆ

INTRO

COMMON APPROACHES TO MOBILE APP DEVELOPMENT

• NATIVE APPROACH

• HYBRID APPROACH

• XAMARIN APPROACH

01 NATIVE APPROACH

“SILO”

02 HYBRID APPROACH

“BLACK BOX”

03 XAMARIN APPROACH

“UNIQUE APPROACH”

04 XAMARIN PLATFORM

WHAT YOU GET WITH XAMARIN?

• single language C#(F#)

• class library

• runtime that works across platforms

• complete binding for underlying platform

• ability to directly invoke ObjC, Java, C, C++

• huge BCL

• powerfull IDE

05 HOW DOES XAMARIN WORK

XAMARIN UNDER THE HOOD

• built on top of Mono, open source .NET framework

• can be run on nearly every imaginable platform • Unix • Linux • FreeBSD • OSX

HOW IT WORKS

• trough usage of P/Invoke Service

MANAGED

SOURCE CODE

COMPILER

COMMON LANGUAGE RUNTIME

STANDARD MARSHALLING

SERVICE

PLATFORM INVOKE

MANAGEDUNMANAGED

DLL FUNCTION

METADATA

IL CODE

ASSEMBLY

HOW IT WORKS - P/INVOKE

1. read [*h] header files to map [C/Obj-C] API to [C#] → (marshalling)

2. compile [*.m/*.mm/*.c] files to object files and link them into static/

dynamic libraries.

3. embed libraries from #2. step into .Net project

4. generate [C#] wrappers to expose #2. to the [C#] world

NATIVE PERFORMANCE

06 POSSIBLE ISSUES

POSSIBLE ISSUES

• binding of third party libraries • Xamarin Store, lots of open sourced components • If missing, you need to BIND it yourself

• memory management • lambdas + GC + marshalling

• (object references across interop boundaries)

07 HOW TO START

GETTING STARTED

• MAC:

• Xamarin Studio [UI + CODE]

• Xamarin Studio [Code] + Xcode [UI]

• WINDOWS:

• Visual Studio [UI + CODE] + MAC for building

• Xamarin Studio [UI + CODE] + MAC for building

* installer will download everything that you need (SDK, …)

HOW DOES IT FEEL :)?

Q&A