SlideShare une entreprise Scribd logo
1  sur  44
Xamarin.Mac Introduction
Miguel de Icaza, CTO Xamarin
miguel@xamarin.com
January 10th 2013
Xamarin.Mac Overview
• Build Mac applications with C#
– Use C# and .NET libraries on Mac
– All that you love:
• LINQ, Task Parallel Library, async
• GC, type safety, generics, dynamic and more.
– Mac AppStore ready
• Native Applications
– Use native APIs to deeply integrate with OSX
Xamarin.Mac Overview
2.2B devices reachable with C#
Xamarin.Mac at a Glance
Mono Runtime
Xamaric.Mac
Libraries
Mono Core Class
Libraries
Tools and SDK
• Binder
• Bundler
• Linker
• Packager
MonoDevelop IDE
Xcode
(UI Designer)
Cocoa Frameworks
System Libraries
Darwin OS
Xamarin.Mac Frameworks
• CoreGraphics
• CoreImage
• CoreText
• CoreVideo
Graphics
• ImageKit
• ImageIO
• OpenGL
• PDFKit
• AppKit
• CoreAnimation
• CoreImage
User Interface
• QCComposer
• QuickLook
• SceneKit
• WebKit
• AVFoundation
• AudioToolbox
• AudioUnit
Audio and Video
• CoreMidi
• CoreMedia
• OpenAL
• AddressBook
• Bluetooth
• CoreLocation
• CoreServices
System Services
• CoreWLan
• ScriptingBridge
• StoreKit
• CoreData
• CoreFoundation
• Darwin
Infrastructure
• Foundation
• ObjCRuntime
• Security
Lots shared with MonoTouch (iOS)
• CoreGraphics
• CoreImage
• CoreText
• CoreVideo
Graphics
• ImageKit
• ImageIO
• OpenGL
• PDFKit
• AppKit
• CoreAnimation
• CoreGraphics
• CoreImage
User Interface
• QCComposer
• QuickLook
• SceneKit
• WebKit
• AVFoundation
• AudioToolbox
• AudioUnit
Audio and Video
• CoreMidi
• CoreMedia
• OpenAL
• AddressBook
• Bluetooth
• CoreLocation
• CoreServices
System Services
• CoreWLan
• ScriptingBridge
• StoreKit
• CoreData
• CoreFoundation
• Darwin
Infrastructure
• Foundation
• ObjCRuntime
• Security
How does Xamarin.Mac work?
• OSX Libraries Projected to C#
– 1:1 mapping from OSX native APIs to C#
• Objective-C (80% of APIs)
– Object system mapped
– Supports subclassing and overriding
• C-based APIs (20% of APIs)
– Exposed as C# classes/methods
– No support for subclassing or overriding
The Basics
• CoreGraphics
• CoreImage
• CoreText
• CoreVideo
Graphics
• ImageKit
• ImageIO
• OpenGL
• PDFKit
• AppKit
• CoreAnimation
• CoreImage
User Interface
• QCComposer
• QuickLook
• SceneKit
• WebKit
• AVFoundation
• AudioToolbox
• AudioUnit
Audio and Video
• CoreMidi
• CoreMedia
• OpenAL
• AddressBook
• Bluetooth
• CoreLocation
• CoreServices
System Services
• CoreWLan
• ScriptingBridge
• StoreKit
• CoreData
• CoreFoundation
• Darwin
Infrastructure
• Foundation
• ObjCRuntime
• Security
Anatomy of a Xamarin.Mac App
NSDocument version
Application Delegate
Called with application events, among them
“FinishedLaunching”
Info.plist
Application metadata, used by the OS
(app name, requirements, doc type handlers, etc)
Main application menu
Interface definition for your main menu
Implementation for your main window
Code to implement the features of your
Document handler.
Main Window UI Definition
UI for your Main Window, edited with
Xcode.
Results
Structure of your App
NSWindow
The toplevel window in your app
NSWindow.ContentView
An NSViews, hosts all content
NSViews – Powerful containers
• NSViews can contain other NSViews
• NSViews can handle events
• NSViews can paint themselves
• NSViews can layout their nested NSViews
• NSViews can be backed by a CALayer
– CALayers are GPU accelerated
• NSView properties can be animated
NSWindow and nested NSViews
AppKit - Application Framework
• Pervasive use of Model View Controller
– Unless you are writing a custom control
– All logic goes into your controller class
– Controller orchestrates work of views
• Goes beyond the standard offering
– High-level NSDocument does the heavy lifting
– Full Menu, Saving, Loading, multi-window support
Extending our first Window
Create + Initialize Object
Hook up some code, lambda
Subclass
My app in Action
Creating Beautiful Interfaces
• Launch Xcode to edit
XIB files.
• Activate side-by-side
view
• Control-drag to source
file.
Connecting your code
Exposing the UI to Code
• Outlets
– Allows you to reference an object from code
– Control-drag to source pane, and give it a name
• Actions
– Allows a method to be invoked as a response
– Control drag to source pane, and give a name
• In C# land
– Actions become partial methods in your class
– Outlets become properties in your class
Implementing Actions and using Outlets
Running
Behind the Scenes
Events and Callbacks
• In the C# world we are used to objects
broadcasting events. Like this:
– var myControl = new SomeControl ();
– myControl.Clicked += SaveFile;
– myControl.FocusIn += MakeFontBold;
– myControl.FocusOut += ResetFont;
MyControl
SaveFile
MakeFontBold
ResetFont
Apple’s Idiom
• Objects instead send interesting events to a
“Delegate”. All messages are sent there.
var myControl = new SomeControl ()
myControl.Delegate = new MyControlDelegate ()
myControlDelegate
class MyControlDelegate : ControlDelegate {
override Clicked () {…}
override FocusIn () {…}
override FocusOut () {…}
}
myControl
Xamarin.Mac and Delegates
• Both models are supported
– You get to choose in a per-instance basis
• Apple Delegate pattern mapped to C# events
– Internally, we create the Delegate class, map it to
your C# lambda/anonymous method/delegate
• One replaces the other
SHIPPING YOUR APP
Shipping Your App - Yourself
• App has full access to the system
• Applications are shipped as “bundles”
– Directory with .app extension
– Self-contained, with no external dependencies
– Optionally: generate installer from IDE as well.
• MacOS recently enabled GateKeeper
– This requires you to sign your app
– Or apps wont start on modern systems1 (by default)
1. Technically any Mac running Mountain Lion (10.8.xx) or Lion 10.7.5 and newer
Shipping your App - AppStore
• Mac App Store
– Must apply to Apple for developer program
– Must sign application
– Submit app for review
• App will be sandboxed
• IDE signs, packages and launches uploader
• See Xamarin’s docs for tutorial
MacOS X Sandbox
• Kernel enforced sandbox
• Limits access to the system:
– Limitations on file system access
– Use special Open/Save dialog panels
– Limits access to services, and some kernel APIs
Mac AppStore – Sandbox Configuration
Info.plist
Editing this file brings up
the metadata editor.
Use this editor to configure
your application requirements
from the sandbox.
Next Steps
Learn more at:
- xamarin.com/mac
- Docs.xamarin.com
Free trial:
- xamarin.com/trial
April 14 – 17, Austin, TX
2 Days of Xamarin Technical Training &
Certification
2 Conference days covering all things mobile
Keynotes by Nat, Miguel and Scott Hanselman
Call for speakers officially open & sponsorship
information available at evolve@xamarin.com
Deep Dive at Xamarin Evolve 2013
Pricing
• Free trial at xamarin.com/trial
• Professional: $399
• Enterprise: $999 per seat
• Enterprise Priority: $2,499 per seat
Resources
• Xamarin’s Mac Resources:
– http://docs.xamarin.com/mac
• API documentation:
– Installed on first use (Apple + Xamarin Docs)
• C# samples: https://github.com/xamarin/mac-samples
• Support Forum: http://forums.xamarin.com/categories/mac
• Apple Developer Portal: http://developer.apple.com/mac
• Xamarin’s Evolve conference: http://xamarin.com/evolve
MORE INFORMATION
TouchDraw and iCircuit
• TouchDraw
• iCircuit
PROJECTIONS
Objective-C Projection to C#
• What we map:
– Classes
– Structures
– Methods and Properties
– Objective-C blocks
– Public global fields
– Notifications
– Dictionaries
– Core data types
• Follow the .NET Framework Design Guidelines
Projecting Classes and Structs
• Identical class names
• Scoped by namespace
Example:
NSWindow and NSURL
Become
MonoMac.AppKit.NSWindow
MonoMac.Foundation.NSUrl
Projecting Methods and Properties
• We rename methods to follow .NET FDG
• Use C# overloading
Example:
-(void) drawString:(NSString *) str atPoint:(CGPoint)pos
-(void) drawString:(NSString *) str
Becomes:
void DrawString (string str)
void DrawString (string str, PointF position)
Projecting Blocks
• Blocks are Objective-C lambdas
• They are mapped to C# delegates
– Can be used with C# lambdas or methods
Example:
(int)(^)(string msg, int flag)
Becomes:
delegate int X (string msg, int flag)
Projecting Notifications
Regular Style/Objective-C Strongly Typed
• Notifications are posted as strings + Dictionary
• We map those to strong types + EventArgs
Projecting NSDictionary Options
• Dictionaries are used to pass parameters
• Loosely typed, hard to debug, hard to find
• We provide strongly typed classes
• They implicitly convert to NSDictionary
– With the right magic keys
– With the correct types for parameters
AppKit – The Heart of Mac Apps

Contenu connexe

Tendances

A tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWSA tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWSAmazon Web Services
 
Development tools
Development toolsDevelopment tools
Development toolsParag Patil
 
Leveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWSLeveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWSAmazon Web Services
 
Building a Serverless Pipeline
Building a Serverless PipelineBuilding a Serverless Pipeline
Building a Serverless PipelineJulien SIMON
 
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar Series
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar SeriesContinuous Delivery with AWS Lambda - AWS April 2016 Webinar Series
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar SeriesAmazon Web Services
 
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with ContainersAmazon Web Services
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeployAmazon Web Services
 
Grow and Retain Users with Analytics and Push Notifications
Grow and Retain Users with Analytics and Push NotificationsGrow and Retain Users with Analytics and Push Notifications
Grow and Retain Users with Analytics and Push NotificationsAmazon Web Services
 
AWS Lambda from the Trenches
AWS Lambda from the TrenchesAWS Lambda from the Trenches
AWS Lambda from the TrenchesYan Cui
 
DevOps, Microservices and Serverless Architecture
DevOps, Microservices and Serverless ArchitectureDevOps, Microservices and Serverless Architecture
DevOps, Microservices and Serverless ArchitectureMikhail Prudnikov
 
AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...Luciano Mammino
 
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...Amazon Web Services
 
Migrare Applicazioni Web su Azure
Migrare Applicazioni Web su AzureMigrare Applicazioni Web su Azure
Migrare Applicazioni Web su AzureMarco Parenzan
 
Continuous Deployment with Amazon Web Services
Continuous Deployment with Amazon Web ServicesContinuous Deployment with Amazon Web Services
Continuous Deployment with Amazon Web ServicesJulien SIMON
 
Aws Lambda Cart Microservice Server Less
Aws Lambda Cart Microservice Server LessAws Lambda Cart Microservice Server Less
Aws Lambda Cart Microservice Server LessDhanu Gupta
 
Getting Started with Docker on AWS
Getting Started with Docker on AWSGetting Started with Docker on AWS
Getting Started with Docker on AWSAmazon Web Services
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapDaniel Zivkovic
 
(DVO306) AWS CodeDeploy: Automating Your Software Deployments
(DVO306) AWS CodeDeploy: Automating Your Software Deployments(DVO306) AWS CodeDeploy: Automating Your Software Deployments
(DVO306) AWS CodeDeploy: Automating Your Software DeploymentsAmazon Web Services
 

Tendances (20)

A tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWSA tale of two pizzas: Developer tools at AWS
A tale of two pizzas: Developer tools at AWS
 
Development tools
Development toolsDevelopment tools
Development tools
 
Leveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWSLeveraging Elastic Web-Scale Computing with AWS
Leveraging Elastic Web-Scale Computing with AWS
 
Building a Serverless Pipeline
Building a Serverless PipelineBuilding a Serverless Pipeline
Building a Serverless Pipeline
 
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar Series
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar SeriesContinuous Delivery with AWS Lambda - AWS April 2016 Webinar Series
Continuous Delivery with AWS Lambda - AWS April 2016 Webinar Series
 
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
 
Grow and Retain Users with Analytics and Push Notifications
Grow and Retain Users with Analytics and Push NotificationsGrow and Retain Users with Analytics and Push Notifications
Grow and Retain Users with Analytics and Push Notifications
 
AWS Lambda from the Trenches
AWS Lambda from the TrenchesAWS Lambda from the Trenches
AWS Lambda from the Trenches
 
DevOps, Microservices and Serverless Architecture
DevOps, Microservices and Serverless ArchitectureDevOps, Microservices and Serverless Architecture
DevOps, Microservices and Serverless Architecture
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...AWS Lambda and Serverless framework: lessons learned while building a serverl...
AWS Lambda and Serverless framework: lessons learned while building a serverl...
 
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
 
Migrare Applicazioni Web su Azure
Migrare Applicazioni Web su AzureMigrare Applicazioni Web su Azure
Migrare Applicazioni Web su Azure
 
Architecting iOS Project
Architecting iOS ProjectArchitecting iOS Project
Architecting iOS Project
 
Continuous Deployment with Amazon Web Services
Continuous Deployment with Amazon Web ServicesContinuous Deployment with Amazon Web Services
Continuous Deployment with Amazon Web Services
 
Aws Lambda Cart Microservice Server Less
Aws Lambda Cart Microservice Server LessAws Lambda Cart Microservice Server Less
Aws Lambda Cart Microservice Server Less
 
Getting Started with Docker on AWS
Getting Started with Docker on AWSGetting Started with Docker on AWS
Getting Started with Docker on AWS
 
AWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless RecapAWS re:Invent 2020 Serverless Recap
AWS re:Invent 2020 Serverless Recap
 
(DVO306) AWS CodeDeploy: Automating Your Software Deployments
(DVO306) AWS CodeDeploy: Automating Your Software Deployments(DVO306) AWS CodeDeploy: Automating Your Software Deployments
(DVO306) AWS CodeDeploy: Automating Your Software Deployments
 

Similaire à Xamarin.Mac Introduction

Xamarin.iOS introduction
Xamarin.iOS introductionXamarin.iOS introduction
Xamarin.iOS introductionGuido Magrin
 
Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1drudolph11
 
Demystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data ScientistsDemystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data ScientistsDr Ganesh Iyer
 
Introduction to Cross Platform Development with Xamarin/ Visual Studio
Introduction to Cross Platform Development with Xamarin/ Visual StudioIntroduction to Cross Platform Development with Xamarin/ Visual Studio
Introduction to Cross Platform Development with Xamarin/ Visual StudioIndyMobileNetDev
 
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...Patrick Chanezon
 
Built in NM - Meetup Talk - CTL Labs
Built in NM - Meetup Talk - CTL LabsBuilt in NM - Meetup Talk - CTL Labs
Built in NM - Meetup Talk - CTL LabsRoss Jimenez
 
Microservices and containers for the unitiated
Microservices and containers for the unitiatedMicroservices and containers for the unitiated
Microservices and containers for the unitiatedKevin Lee
 
Nike pop up habitat
Nike pop up   habitatNike pop up   habitat
Nike pop up habitatChef
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015WaveMaker, Inc.
 
Dockers and kubernetes
Dockers and kubernetesDockers and kubernetes
Dockers and kubernetesDr Ganesh Iyer
 
NET Conf Bhubaneswar - Migrating your Xamarin.Forms app to .NET MAUI.pptx
NET Conf Bhubaneswar - Migrating your Xamarin.Forms app to .NET MAUI.pptxNET Conf Bhubaneswar - Migrating your Xamarin.Forms app to .NET MAUI.pptx
NET Conf Bhubaneswar - Migrating your Xamarin.Forms app to .NET MAUI.pptxLuis Beltran
 
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allEclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allMarc Dutoo
 
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware
 
Fossetcon: Crash Course on Open Source Cloud Computing
Fossetcon: Crash Course on Open Source Cloud ComputingFossetcon: Crash Course on Open Source Cloud Computing
Fossetcon: Crash Course on Open Source Cloud ComputingMark Hinkle
 
Highlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceHighlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceChristopher Miller
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to XamarinBrian Anderson
 
Introduction to Docker - Vellore Institute of Technology
Introduction to Docker - Vellore Institute of TechnologyIntroduction to Docker - Vellore Institute of Technology
Introduction to Docker - Vellore Institute of TechnologyAjeet Singh Raina
 
Introduction to Docker - VIT Campus
Introduction to Docker - VIT CampusIntroduction to Docker - VIT Campus
Introduction to Docker - VIT CampusAjeet Singh Raina
 

Similaire à Xamarin.Mac Introduction (20)

Xamarin.iOS introduction
Xamarin.iOS introductionXamarin.iOS introduction
Xamarin.iOS introduction
 
Apache cordova
Apache cordovaApache cordova
Apache cordova
 
Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1Windows 8 DevUnleashed - Session 1
Windows 8 DevUnleashed - Session 1
 
Demystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data ScientistsDemystifying Containerization Principles for Data Scientists
Demystifying Containerization Principles for Data Scientists
 
Introduction to Cross Platform Development with Xamarin/ Visual Studio
Introduction to Cross Platform Development with Xamarin/ Visual StudioIntroduction to Cross Platform Development with Xamarin/ Visual Studio
Introduction to Cross Platform Development with Xamarin/ Visual Studio
 
Introduction to xamarin
Introduction to xamarinIntroduction to xamarin
Introduction to xamarin
 
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
Docker Orchestration: Welcome to the Jungle! Devoxx & Docker Meetup Tour Nov ...
 
Built in NM - Meetup Talk - CTL Labs
Built in NM - Meetup Talk - CTL LabsBuilt in NM - Meetup Talk - CTL Labs
Built in NM - Meetup Talk - CTL Labs
 
Microservices and containers for the unitiated
Microservices and containers for the unitiatedMicroservices and containers for the unitiated
Microservices and containers for the unitiated
 
Nike pop up habitat
Nike pop up   habitatNike pop up   habitat
Nike pop up habitat
 
Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015Docker & aPaaS: Enterprise Innovation and Trends for 2015
Docker & aPaaS: Enterprise Innovation and Trends for 2015
 
Dockers and kubernetes
Dockers and kubernetesDockers and kubernetes
Dockers and kubernetes
 
NET Conf Bhubaneswar - Migrating your Xamarin.Forms app to .NET MAUI.pptx
NET Conf Bhubaneswar - Migrating your Xamarin.Forms app to .NET MAUI.pptxNET Conf Bhubaneswar - Migrating your Xamarin.Forms app to .NET MAUI.pptx
NET Conf Bhubaneswar - Migrating your Xamarin.Forms app to .NET MAUI.pptx
 
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them allEclipseCon 2016 - OCCIware : one Cloud API to rule them all
EclipseCon 2016 - OCCIware : one Cloud API to rule them all
 
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open WideOCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
OCCIware Project at EclipseCon France 2016, by Marc Dutoo, Open Wide
 
Fossetcon: Crash Course on Open Source Cloud Computing
Fossetcon: Crash Course on Open Source Cloud ComputingFossetcon: Crash Course on Open Source Cloud Computing
Fossetcon: Crash Course on Open Source Cloud Computing
 
Highlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceHighlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conference
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 
Introduction to Docker - Vellore Institute of Technology
Introduction to Docker - Vellore Institute of TechnologyIntroduction to Docker - Vellore Institute of Technology
Introduction to Docker - Vellore Institute of Technology
 
Introduction to Docker - VIT Campus
Introduction to Docker - VIT CampusIntroduction to Docker - VIT Campus
Introduction to Docker - VIT Campus
 

Dernier

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Dernier (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Xamarin.Mac Introduction

  • 1. Xamarin.Mac Introduction Miguel de Icaza, CTO Xamarin miguel@xamarin.com January 10th 2013
  • 2. Xamarin.Mac Overview • Build Mac applications with C# – Use C# and .NET libraries on Mac – All that you love: • LINQ, Task Parallel Library, async • GC, type safety, generics, dynamic and more. – Mac AppStore ready • Native Applications – Use native APIs to deeply integrate with OSX
  • 4. Xamarin.Mac at a Glance Mono Runtime Xamaric.Mac Libraries Mono Core Class Libraries Tools and SDK • Binder • Bundler • Linker • Packager MonoDevelop IDE Xcode (UI Designer) Cocoa Frameworks System Libraries Darwin OS
  • 5. Xamarin.Mac Frameworks • CoreGraphics • CoreImage • CoreText • CoreVideo Graphics • ImageKit • ImageIO • OpenGL • PDFKit • AppKit • CoreAnimation • CoreImage User Interface • QCComposer • QuickLook • SceneKit • WebKit • AVFoundation • AudioToolbox • AudioUnit Audio and Video • CoreMidi • CoreMedia • OpenAL • AddressBook • Bluetooth • CoreLocation • CoreServices System Services • CoreWLan • ScriptingBridge • StoreKit • CoreData • CoreFoundation • Darwin Infrastructure • Foundation • ObjCRuntime • Security
  • 6. Lots shared with MonoTouch (iOS) • CoreGraphics • CoreImage • CoreText • CoreVideo Graphics • ImageKit • ImageIO • OpenGL • PDFKit • AppKit • CoreAnimation • CoreGraphics • CoreImage User Interface • QCComposer • QuickLook • SceneKit • WebKit • AVFoundation • AudioToolbox • AudioUnit Audio and Video • CoreMidi • CoreMedia • OpenAL • AddressBook • Bluetooth • CoreLocation • CoreServices System Services • CoreWLan • ScriptingBridge • StoreKit • CoreData • CoreFoundation • Darwin Infrastructure • Foundation • ObjCRuntime • Security
  • 7. How does Xamarin.Mac work? • OSX Libraries Projected to C# – 1:1 mapping from OSX native APIs to C# • Objective-C (80% of APIs) – Object system mapped – Supports subclassing and overriding • C-based APIs (20% of APIs) – Exposed as C# classes/methods – No support for subclassing or overriding
  • 8. The Basics • CoreGraphics • CoreImage • CoreText • CoreVideo Graphics • ImageKit • ImageIO • OpenGL • PDFKit • AppKit • CoreAnimation • CoreImage User Interface • QCComposer • QuickLook • SceneKit • WebKit • AVFoundation • AudioToolbox • AudioUnit Audio and Video • CoreMidi • CoreMedia • OpenAL • AddressBook • Bluetooth • CoreLocation • CoreServices System Services • CoreWLan • ScriptingBridge • StoreKit • CoreData • CoreFoundation • Darwin Infrastructure • Foundation • ObjCRuntime • Security
  • 9.
  • 10. Anatomy of a Xamarin.Mac App NSDocument version Application Delegate Called with application events, among them “FinishedLaunching” Info.plist Application metadata, used by the OS (app name, requirements, doc type handlers, etc) Main application menu Interface definition for your main menu Implementation for your main window Code to implement the features of your Document handler. Main Window UI Definition UI for your Main Window, edited with Xcode.
  • 12. Structure of your App NSWindow The toplevel window in your app NSWindow.ContentView An NSViews, hosts all content
  • 13. NSViews – Powerful containers • NSViews can contain other NSViews • NSViews can handle events • NSViews can paint themselves • NSViews can layout their nested NSViews • NSViews can be backed by a CALayer – CALayers are GPU accelerated • NSView properties can be animated
  • 15. AppKit - Application Framework • Pervasive use of Model View Controller – Unless you are writing a custom control – All logic goes into your controller class – Controller orchestrates work of views • Goes beyond the standard offering – High-level NSDocument does the heavy lifting – Full Menu, Saving, Loading, multi-window support
  • 16. Extending our first Window Create + Initialize Object Hook up some code, lambda Subclass
  • 17. My app in Action
  • 18. Creating Beautiful Interfaces • Launch Xcode to edit XIB files. • Activate side-by-side view • Control-drag to source file.
  • 20. Exposing the UI to Code • Outlets – Allows you to reference an object from code – Control-drag to source pane, and give it a name • Actions – Allows a method to be invoked as a response – Control drag to source pane, and give a name • In C# land – Actions become partial methods in your class – Outlets become properties in your class
  • 21. Implementing Actions and using Outlets
  • 24. Events and Callbacks • In the C# world we are used to objects broadcasting events. Like this: – var myControl = new SomeControl (); – myControl.Clicked += SaveFile; – myControl.FocusIn += MakeFontBold; – myControl.FocusOut += ResetFont; MyControl SaveFile MakeFontBold ResetFont
  • 25. Apple’s Idiom • Objects instead send interesting events to a “Delegate”. All messages are sent there. var myControl = new SomeControl () myControl.Delegate = new MyControlDelegate () myControlDelegate class MyControlDelegate : ControlDelegate { override Clicked () {…} override FocusIn () {…} override FocusOut () {…} } myControl
  • 26. Xamarin.Mac and Delegates • Both models are supported – You get to choose in a per-instance basis • Apple Delegate pattern mapped to C# events – Internally, we create the Delegate class, map it to your C# lambda/anonymous method/delegate • One replaces the other
  • 28. Shipping Your App - Yourself • App has full access to the system • Applications are shipped as “bundles” – Directory with .app extension – Self-contained, with no external dependencies – Optionally: generate installer from IDE as well. • MacOS recently enabled GateKeeper – This requires you to sign your app – Or apps wont start on modern systems1 (by default) 1. Technically any Mac running Mountain Lion (10.8.xx) or Lion 10.7.5 and newer
  • 29. Shipping your App - AppStore • Mac App Store – Must apply to Apple for developer program – Must sign application – Submit app for review • App will be sandboxed • IDE signs, packages and launches uploader • See Xamarin’s docs for tutorial
  • 30. MacOS X Sandbox • Kernel enforced sandbox • Limits access to the system: – Limitations on file system access – Use special Open/Save dialog panels – Limits access to services, and some kernel APIs
  • 31. Mac AppStore – Sandbox Configuration Info.plist Editing this file brings up the metadata editor. Use this editor to configure your application requirements from the sandbox.
  • 32. Next Steps Learn more at: - xamarin.com/mac - Docs.xamarin.com Free trial: - xamarin.com/trial April 14 – 17, Austin, TX 2 Days of Xamarin Technical Training & Certification 2 Conference days covering all things mobile Keynotes by Nat, Miguel and Scott Hanselman Call for speakers officially open & sponsorship information available at evolve@xamarin.com Deep Dive at Xamarin Evolve 2013
  • 33. Pricing • Free trial at xamarin.com/trial • Professional: $399 • Enterprise: $999 per seat • Enterprise Priority: $2,499 per seat
  • 34. Resources • Xamarin’s Mac Resources: – http://docs.xamarin.com/mac • API documentation: – Installed on first use (Apple + Xamarin Docs) • C# samples: https://github.com/xamarin/mac-samples • Support Forum: http://forums.xamarin.com/categories/mac • Apple Developer Portal: http://developer.apple.com/mac • Xamarin’s Evolve conference: http://xamarin.com/evolve
  • 36. TouchDraw and iCircuit • TouchDraw • iCircuit
  • 38. Objective-C Projection to C# • What we map: – Classes – Structures – Methods and Properties – Objective-C blocks – Public global fields – Notifications – Dictionaries – Core data types • Follow the .NET Framework Design Guidelines
  • 39. Projecting Classes and Structs • Identical class names • Scoped by namespace Example: NSWindow and NSURL Become MonoMac.AppKit.NSWindow MonoMac.Foundation.NSUrl
  • 40. Projecting Methods and Properties • We rename methods to follow .NET FDG • Use C# overloading Example: -(void) drawString:(NSString *) str atPoint:(CGPoint)pos -(void) drawString:(NSString *) str Becomes: void DrawString (string str) void DrawString (string str, PointF position)
  • 41. Projecting Blocks • Blocks are Objective-C lambdas • They are mapped to C# delegates – Can be used with C# lambdas or methods Example: (int)(^)(string msg, int flag) Becomes: delegate int X (string msg, int flag)
  • 42. Projecting Notifications Regular Style/Objective-C Strongly Typed • Notifications are posted as strings + Dictionary • We map those to strong types + EventArgs
  • 43. Projecting NSDictionary Options • Dictionaries are used to pass parameters • Loosely typed, hard to debug, hard to find • We provide strongly typed classes • They implicitly convert to NSDictionary – With the right magic keys – With the correct types for parameters
  • 44. AppKit – The Heart of Mac Apps

Notes de l'éditeur

  1. Showcase some applications Frameworks available/bound Introduction to MacOS frameworks C# and Objective-C integration Kinds of programs you can build Small, depend on Mono Self-contained AppStore distribution The structure of a Xamarin.Mac app Main program Main loop Info.plist Editing properties Hands on Section Creating an app with a single window Structure of a project Menus Components. NSAlert (Sheets/Dialogs) Using NSDocument to leverage multiple toplevels What you get with it Debugging
  2. Basically, it is what dreams are made of.
  3. Learn almost everything there is to know about mobile development with Xamarin by attending our two-day Training & Certification program, for only $1,000, on April 14 & 15. Our fast-paced professional training days will give you an opportunity to dive deep and expand your expertise. And then join us for the Xamarin Evolve 2013 Conference, priced at $899, on April 16 & 17. Buy your tickets now–the first 100 to register will receive a 20% discount. The conference will include inspiring keynotes, a diverse lineup of must-see talks and presentations, and engaging activities like a party and hackathon.