SlideShare une entreprise Scribd logo
1  sur  76
Building your first iOS app
using Xamarin
Gill Cleeren - @gillcleeren
Hi, I’m Gill!
Gill Cleeren
MVP and Regional Director
.NET Practice Manager @ Ordina
Trainer & speaker
@gillcleeren
gill@snowball.be
I’m a Pluralsight author!
• Courses on Windows 8, social and HTML5
• http://gicl.me/mypscourses
Agenda
• Overview of Xamarin and Xamarin.iOS
• Preparing for iOS development
• Xamarin.iOS fundamentals
• TableViews in iOS
• Adding navigation
• Optimizing the application
• Preparing for store deployment
Targets of this talk
• Understanding the fundamentals of iOS app development with
Xamarin
• See how a fully working app can be built
The demo scenario
• iOS Coffee Store Manager
• List of coffee
• Navigation to details page
DEMO
Looking at the finished application
Overview of Xamarin
and Xamarin.iOS
Hello Xamarin
• Xamarin enables developers to reach all major mobile platforms!
• Native User Interface
• Native Performance
• Shared Code Across Platforms
• C# & .NET Framework
• Toolset on top of Visual Studio
• Enables VS to create native iOS and Android apps
• Commercial product
Write Everything in C#
iOS, Android, Windows, Windows Phone, Mac
Billions of Devices covered!
The Xamarin platform
Xamarin
Xamarin.Android Xamarin.iOS Xamarin Forms
Xamarin.iOS
Anything you can do in Objective-C/Swift/XCode can be done in
C# and Visual Studio (or Xamarin Studio) with Xamarin!
iOS Runtime model
• Native ARMx code – no JIT is being used here
• Mono runtime provides system services such as Garbage Collection
• Full access to iOS frameworks such as MapKit as well as .NET BCL
A word on code-sharing
• Xamarin brings development time through the use of code-sharing
• Possible (currently!) using
• Shared projects:
• allows organizing the shared code
• #if directives for platform specific code
• PCL
• “include” the platforms we want to support
• Abstract to interfaces where platforms have specific implementations
Target architecture for a Xamarin app
Preparing for iOS development
What you need for Xamarin.iOS development
• Xamarin license (Xamarin.iOS)
• PC or Mac or Mac only
• Visual Studio or Xamarin Studio (Mac)
• XCode SDK (free)
• Optionally, a VM (VMWare or Parallels) with Windows 7 or 8
• Optionally, a device
• Optionally, a developer account
Installing Xamarin.iOS
iOS development on Windows
• Required: a Mac with latest OSX!
• There are no iOS simulators on Windows!
Windows
Visual Studio
Xamarin iOS plugin in
Visual Studio
Mac with OSX
Xamarin Build
Host
iOS SDK
XCode
Interface Builder
Device
iOS
Simulator
Connecting Windows & Mac
Developing on the Mac? Xamarin Studio!
• Optimized for cross-platform
mobile development
• Explore native APIs with code
completion
• World class Android and iOS
designers
• Powerful debugging on
simulator or device
DEMO
A quick look at the development setup
for Xamarin.iOS
Xamarin.iOS
fundamentals
File  New Project
File  New Project
Fundamental #1: Application structure
• Main.cs
• Entry point of the application
• Main app class is passed: AppDelegate
• AppDelegate.cs
• Main application class
• Builds the window
• Listens for OS events
• MainStoryboard.storyboard
• Visual design of the app and the flow between the screens
Application structure
• ****ViewController.cs
• Powers the view of the app
• View controller handles the interactions between
the user and the view
• ****ViewController.designer.cs
• Auto-generated file
• Glue between controls in the View and
representations in View controller
• Don’t edit this file yourself!
Application structure
• Info.plist
• Property list file
• Contains app properties such as app name, icons,
splash screen images…
• Entitlements.plist
• Allows specifying with capabilities the app is
receiving
• PassKit, iCloud…
Main.cs
• Entry point for the application
• Contains static Main
• Creates the app
• Passes name of application delegate
Application delegate
Fundamental #2: Views & Storyboards
• Views are most commonly created using a Storyboard
• Alternatives: code or *.xib files (XCode)
• Designer can be used to edit the Storyboard
• A Storyboard is a file that contains the visual designs of our application’s
screens as well as the transitions and relationships between the screens
• A screen inside a Storyboard is a Scene
• Each Scene represents a controller and the views it manages (content view hierarchy)
• Most templates create a new storyboard automatically
• An app can have more than one storyboard
Storyboard designer
Auto-generation of the *.designer.cs file
• Controller.cs contains our code
• Handles all that happens in the View
• Controller.designer.cs maps Storyboard controls
to C# objects
• Glue to make controls available in code
• Never edit this file manually!
The *.designer.cs file
Fundamental #3: Controllers
• iOS apps follow MVC pattern
• Actual code lives in View Controller classes
• Each ViewController inherits from UIViewController
• Different “base” view controllers exist
• NavigationViewController
• TabViewController
• SplitViewController
• …
Linking the view and the view controller
• When selecting a screen, we can select the black bar at the bottom
• Points to the View Controller
• Is an instance of UIViewController
• “Code behind”
Types of view controllers
Handling events in the view controller
• Controller needs to respond to user interaction
• Button press, navigation…
• We need to wire up code in the controller to listen for interaction
with a control
• To write code against controls, they are wired up in the *.designer.cs
• From then, we can work with them in the controller classes
• Controls are available for wiring up in the ViewDidLoad()
Responding to user interaction
DEMO
Creating our first iOS application together!
Adding a list
using
UITableView
I’d like an app for this
please.
The UITableView
• Lists of data can be visualized using the UITableView
• Can also be used for detail screens
• Contains cells (individual rows)
• Can have index and grouping (headers and footers)
• Can be placed in editing mode to allow data management
• Similar to Android: works with intermediate: UITableViewSource
Typical visualizations of the UITableView
Plain Index Grouped Edit
Participating classes
• UITableView
• UITableViewCell
• UITableViewSource
• UITableViewController
Loading data in the UITableView
• Each UITableView is assigned a UITableViewSource
• Table queries the source to learn how it should be rendered
• How many rows
• How high are the rows (if not default)
• Source supplies each cell view, populated with data
• 2 methods are required to show data
• RowsInSection
• returns an int count of the total number of rows of data the table should display
• GetCell
• return a UITableCellView populated with data for the corresponding row index passed to
the method
DEMO
Loading a list of data
I’d like an app for this
please.
Changing the appearance of the cells
• iOS comes with 4 built-in styles
• We can create our own styles as well
Built-in styles
Default Subtitle Value1 Value2
Using a built-in styles
cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier);
cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellIdentifier);
cell = new UITableViewCell (UITableViewCellStyle.Value1, cellIdentifier);
cell = new UITableViewCell (UITableViewCellStyle.Value2, cellIdentifier);
Creating your own cell layout
• It’s possible to provide an entirely different cell
• Different color
• Different control layout
• We need to create a new UITableViewCell
• Implements
• Constructor
• Creates the UI controls and sets the custom style properties
• UpdateCell
• Method for UITableView.GetCell to use to set the cell’s properties
• LayoutSubviews
• Set the location of the UI controls
• Possible to have more than one layout and create them based on content being displayed
DEMO
Changing our table view
Navigation
Navigation with the UINavigationController
• NavigationController is a lookless controller (UINavigationController)
• Is special type of UIViewController
• Allows navigating from one screen to another
• Doesn’t really manage a Content View Hierarchy
• Instead manages other View controllers
• + A specific, own view hierarchy including a navigation bar, title, back button…
• VERY common pattern in iOS
Navigation with the UINavigationController
• Allows us to navigate to second screen
• New views are pushed on the stack
Add to
stack
Navigation with the UINavigationController
• Can provide a back button on the title bar
• Pops the current controller off the back stack
• Loads previous one again
Remove from
stack
The NavigationController
• Automatically provides a title bar
• Can be used to display controller title
Concept of the root view controller
• Navigation controller is lookless
• Needs to be paired with a Root View Controller
• Root view controller is first controller in the stack
• Loads the first content view hierarchy into the window
Actual navigation: Segues
• Navigation/transition to another view is done (mostly) through
the use of Segues (pronounced Segways)
• Shown using arrow between views
• A storyboard can contain a segue with no source:
Sourceless segue
• This view will get loaded when the application starts
Actual navigation: Segues
• Adding segues can be done in the storyboard designer
• Gives choice of desired action
Passing data with segues
• PrepareForSegue is called before transition is executed
• We can access the next view controller using the DestinationViewController
property on the Segue
DEMO
Adding a second screen
and navigation
Optimizing the application
Application properties: info.plist
Application
image resources
Icon sizes
• Icons (and other images) are required to be added in different
resolutions
iOS 5/6 iOS 7/8 iOS 8 (6plus)
1x 2x 1x 2x 3x
App icon 57x57 114x114 Not supported 120x120 180x180
Spotlight 29x29 58x58 80x80 120x120
Settings 29x29 58x58 - - 87x87
entitlements.plist
DEMO
Adding application icons
Store
deployment
Deploying your apps to the store
• Store deployment involves 3 major parts
• Provisioning
• Creating a profile that includes code-signing information used to publish the app
• iTunes Connect information settings
• Online tool to add information that will be used for the application’s page in the App
Store
• Application Submission
• Signed binary can be uploaded to Apple for review
• Will be published in the store soon after that
Things to do before submitting
• App needs to meet Apple’s guidelines for quality and content
• Can be rejected
• Must be fixed and resubmitted
• Guidelines can be found at https://developer.apple.com/app-
store/review/guidelines/
• Test the app for crashes under normal circumstances
• Make sure the description matches what the app does!
Summary
• Xamarin.iOS leverages your C# knowledge to build apps for Android
• iOS is further from regular .NET development
• Getting your head around UI paradigms will take time!
Thanks!
Q&A
Building your first iOS app
using Xamarin
Gill Cleeren - @gillcleeren
Your feedback is important!
Scan the QR Code and let us know via the TechDays App.
Laat ons weten wat u van de sessie vindt via de TechDays App!
Scan de QR Code.
Bent u al lid van de Microsoft Virtual Academy?! Op MVA kunt u altijd iets
nieuws leren over de laatste technologie van Microsoft. Meld u vandaag aan
op de MVA Stand. MVA biedt 7/24 gratis online training on-demand voor IT-
Professionals en Ontwikkelaars.

Contenu connexe

Tendances

Xamarin Platform
Xamarin PlatformXamarin Platform
Xamarin PlatformRui Marinho
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to XamarinBrian Anderson
 
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
 
Hybrid Mobile Development
Hybrid Mobile DevelopmentHybrid Mobile Development
Hybrid Mobile DevelopmentShai Raiten
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms BootcampMike Melusky
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
Building Mobile Apps With Xamarin and Visual Studio App Center
Building Mobile Apps With Xamarin and Visual Studio App CenterBuilding Mobile Apps With Xamarin and Visual Studio App Center
Building Mobile Apps With Xamarin and Visual Studio App CenterSharePoint Saturday New Jersey
 
Native App Development for iOS, Android, and Windows with Visual Studio
Native App Development for iOS, Android, and Windows with Visual StudioNative App Development for iOS, Android, and Windows with Visual Studio
Native App Development for iOS, Android, and Windows with Visual StudioXamarin
 
Building iOS applications with Xamarin and C#
Building iOS applications with Xamarin and C#Building iOS applications with Xamarin and C#
Building iOS applications with Xamarin and C#Tom Walker
 
.NET North UG - What’s new & next for Xamarin developers
.NET North UG - What’s new & next for Xamarin developers.NET North UG - What’s new & next for Xamarin developers
.NET North UG - What’s new & next for Xamarin developersJames Montemagno
 
Cape Town MS Developer User Group: Xamarin Community Toolkit
Cape Town MS Developer User Group: Xamarin Community ToolkitCape Town MS Developer User Group: Xamarin Community Toolkit
Cape Town MS Developer User Group: Xamarin Community ToolkitJavier Suárez Ruiz
 

Tendances (20)

Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 
Xamarin Platform
Xamarin PlatformXamarin Platform
Xamarin Platform
 
Xamarin microsoft graph
Xamarin microsoft graphXamarin microsoft graph
Xamarin microsoft graph
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 
Intro to Xamarin
Intro to XamarinIntro to Xamarin
Intro to Xamarin
 
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
 
Hybrid Mobile Development
Hybrid Mobile DevelopmentHybrid Mobile Development
Hybrid Mobile Development
 
Azure mobile services
Azure mobile servicesAzure mobile services
Azure mobile services
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms Bootcamp
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Introduction to xamarin
Introduction to xamarinIntroduction to xamarin
Introduction to xamarin
 
Xamarin DevOps
Xamarin DevOpsXamarin DevOps
Xamarin DevOps
 
Building Mobile Apps With Xamarin and Visual Studio App Center
Building Mobile Apps With Xamarin and Visual Studio App CenterBuilding Mobile Apps With Xamarin and Visual Studio App Center
Building Mobile Apps With Xamarin and Visual Studio App Center
 
Prism Forms App
Prism Forms AppPrism Forms App
Prism Forms App
 
Xamarin tools
Xamarin toolsXamarin tools
Xamarin tools
 
Native App Development for iOS, Android, and Windows with Visual Studio
Native App Development for iOS, Android, and Windows with Visual StudioNative App Development for iOS, Android, and Windows with Visual Studio
Native App Development for iOS, Android, and Windows with Visual Studio
 
Building iOS applications with Xamarin and C#
Building iOS applications with Xamarin and C#Building iOS applications with Xamarin and C#
Building iOS applications with Xamarin and C#
 
.NET North UG - What’s new & next for Xamarin developers
.NET North UG - What’s new & next for Xamarin developers.NET North UG - What’s new & next for Xamarin developers
.NET North UG - What’s new & next for Xamarin developers
 
Cape Town MS Developer User Group: Xamarin Community Toolkit
Cape Town MS Developer User Group: Xamarin Community ToolkitCape Town MS Developer User Group: Xamarin Community Toolkit
Cape Town MS Developer User Group: Xamarin Community Toolkit
 
Xamarin.Forms
Xamarin.FormsXamarin.Forms
Xamarin.Forms
 

Similaire à Building your first iOS app using Xamarin

iOS Programming 101
iOS Programming 101iOS Programming 101
iOS Programming 101rwenderlich
 
Xamarin.iOS introduction
Xamarin.iOS introductionXamarin.iOS introduction
Xamarin.iOS introductionGuido Magrin
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's NewNascentDigital
 
Session 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationSession 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationVu Tran Lam
 
Synapse india reviews on i phone and android os
Synapse india reviews on i phone and android osSynapse india reviews on i phone and android os
Synapse india reviews on i phone and android ossaritasingh19866
 
Building your first android app using xamarin (Gill Cleeren)
Building your first android app using xamarin (Gill Cleeren)Building your first android app using xamarin (Gill Cleeren)
Building your first android app using xamarin (Gill Cleeren)Visug
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin formsSolTech, Inc.
 
Native script overview
Native script overviewNative script overview
Native script overviewBaskar rao Dsn
 
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone DevelopmentiPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone Developmentandriajensen
 
Session 16 - Designing universal interface which used for iPad and iPhone
Session 16  -  Designing universal interface which used for iPad and iPhoneSession 16  -  Designing universal interface which used for iPad and iPhone
Session 16 - Designing universal interface which used for iPad and iPhoneVu Tran Lam
 
I pad uicatalog_lesson02
I pad uicatalog_lesson02I pad uicatalog_lesson02
I pad uicatalog_lesson02Rich Helton
 
Apple Watch and Xamarin (NoVA Mobile C# Dev Group 4/8/15)
Apple Watch and Xamarin (NoVA Mobile C# Dev Group 4/8/15)Apple Watch and Xamarin (NoVA Mobile C# Dev Group 4/8/15)
Apple Watch and Xamarin (NoVA Mobile C# Dev Group 4/8/15)Ed Snider
 
Migrating Unity3D projects to Windows 8
Migrating Unity3D projects to Windows 8Migrating Unity3D projects to Windows 8
Migrating Unity3D projects to Windows 8282productions
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Michael Shrove
 
Native Script Atlanta Code Camp
Native Script Atlanta Code CampNative Script Atlanta Code Camp
Native Script Atlanta Code CampBaskar rao Dsn
 

Similaire à Building your first iOS app using Xamarin (20)

iOS Programming 101
iOS Programming 101iOS Programming 101
iOS Programming 101
 
Xamarin.iOS introduction
Xamarin.iOS introductionXamarin.iOS introduction
Xamarin.iOS introduction
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's New
 
Synapse india mobile apps update
Synapse india mobile apps updateSynapse india mobile apps update
Synapse india mobile apps update
 
Session 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationSession 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 application
 
Synapse india reviews on i phone and android os
Synapse india reviews on i phone and android osSynapse india reviews on i phone and android os
Synapse india reviews on i phone and android os
 
Xamarin
XamarinXamarin
Xamarin
 
Building your first android app using xamarin (Gill Cleeren)
Building your first android app using xamarin (Gill Cleeren)Building your first android app using xamarin (Gill Cleeren)
Building your first android app using xamarin (Gill Cleeren)
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
Getting started with Xamarin forms
Getting started with Xamarin formsGetting started with Xamarin forms
Getting started with Xamarin forms
 
Native script overview
Native script overviewNative script overview
Native script overview
 
iOS storyboard
iOS storyboardiOS storyboard
iOS storyboard
 
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone DevelopmentiPhone Camp Birmingham (Bham) - Intro To iPhone Development
iPhone Camp Birmingham (Bham) - Intro To iPhone Development
 
iOS (7) Workshop
iOS (7) WorkshopiOS (7) Workshop
iOS (7) Workshop
 
Session 16 - Designing universal interface which used for iPad and iPhone
Session 16  -  Designing universal interface which used for iPad and iPhoneSession 16  -  Designing universal interface which used for iPad and iPhone
Session 16 - Designing universal interface which used for iPad and iPhone
 
I pad uicatalog_lesson02
I pad uicatalog_lesson02I pad uicatalog_lesson02
I pad uicatalog_lesson02
 
Apple Watch and Xamarin (NoVA Mobile C# Dev Group 4/8/15)
Apple Watch and Xamarin (NoVA Mobile C# Dev Group 4/8/15)Apple Watch and Xamarin (NoVA Mobile C# Dev Group 4/8/15)
Apple Watch and Xamarin (NoVA Mobile C# Dev Group 4/8/15)
 
Migrating Unity3D projects to Windows 8
Migrating Unity3D projects to Windows 8Migrating Unity3D projects to Windows 8
Migrating Unity3D projects to Windows 8
 
Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)
 
Native Script Atlanta Code Camp
Native Script Atlanta Code CampNative Script Atlanta Code Camp
Native Script Atlanta Code Camp
 

Plus de Gill Cleeren

Continuous integration and delivery with Xamarin and VSTS
Continuous integration and delivery with Xamarin and VSTSContinuous integration and delivery with Xamarin and VSTS
Continuous integration and delivery with Xamarin and VSTSGill Cleeren
 
Real world apps with Xamarin and MVVM
Real world apps with Xamarin and MVVMReal world apps with Xamarin and MVVM
Real world apps with Xamarin and MVVMGill Cleeren
 
Bootstrap: the full overview
Bootstrap: the full overviewBootstrap: the full overview
Bootstrap: the full overviewGill Cleeren
 
Top 10 HTML5 features every developer should know!
Top 10 HTML5 features every developer should know!Top 10 HTML5 features every developer should know!
Top 10 HTML5 features every developer should know!Gill Cleeren
 
Building a community - BuildStuff Lithuania 2014
Building a community - BuildStuff Lithuania 2014Building a community - BuildStuff Lithuania 2014
Building a community - BuildStuff Lithuania 2014Gill Cleeren
 
C# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform developmentC# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform developmentGill Cleeren
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQueryGill Cleeren
 
Top 10 HTML5 features
Top 10 HTML5 featuresTop 10 HTML5 features
Top 10 HTML5 featuresGill Cleeren
 
Comparing XAML and HTML: FIGHT!
Comparing XAML and HTML: FIGHT!Comparing XAML and HTML: FIGHT!
Comparing XAML and HTML: FIGHT!Gill Cleeren
 
Why you shouldn't dismiss windows 8 for your lob apps
Why you shouldn't dismiss windows 8 for your lob appsWhy you shouldn't dismiss windows 8 for your lob apps
Why you shouldn't dismiss windows 8 for your lob appsGill Cleeren
 
Advanced MVVM in Windows 8
Advanced MVVM in Windows 8Advanced MVVM in Windows 8
Advanced MVVM in Windows 8Gill Cleeren
 

Plus de Gill Cleeren (12)

Continuous integration and delivery with Xamarin and VSTS
Continuous integration and delivery with Xamarin and VSTSContinuous integration and delivery with Xamarin and VSTS
Continuous integration and delivery with Xamarin and VSTS
 
Real world apps with Xamarin and MVVM
Real world apps with Xamarin and MVVMReal world apps with Xamarin and MVVM
Real world apps with Xamarin and MVVM
 
Hello windows 10
Hello windows 10Hello windows 10
Hello windows 10
 
Bootstrap: the full overview
Bootstrap: the full overviewBootstrap: the full overview
Bootstrap: the full overview
 
Top 10 HTML5 features every developer should know!
Top 10 HTML5 features every developer should know!Top 10 HTML5 features every developer should know!
Top 10 HTML5 features every developer should know!
 
Building a community - BuildStuff Lithuania 2014
Building a community - BuildStuff Lithuania 2014Building a community - BuildStuff Lithuania 2014
Building a community - BuildStuff Lithuania 2014
 
C# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform developmentC# everywhere: Xamarin and cross platform development
C# everywhere: Xamarin and cross platform development
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQuery
 
Top 10 HTML5 features
Top 10 HTML5 featuresTop 10 HTML5 features
Top 10 HTML5 features
 
Comparing XAML and HTML: FIGHT!
Comparing XAML and HTML: FIGHT!Comparing XAML and HTML: FIGHT!
Comparing XAML and HTML: FIGHT!
 
Why you shouldn't dismiss windows 8 for your lob apps
Why you shouldn't dismiss windows 8 for your lob appsWhy you shouldn't dismiss windows 8 for your lob apps
Why you shouldn't dismiss windows 8 for your lob apps
 
Advanced MVVM in Windows 8
Advanced MVVM in Windows 8Advanced MVVM in Windows 8
Advanced MVVM in Windows 8
 

Dernier

WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 

Dernier (20)

WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 

Building your first iOS app using Xamarin

  • 1.
  • 2. Building your first iOS app using Xamarin Gill Cleeren - @gillcleeren
  • 3. Hi, I’m Gill! Gill Cleeren MVP and Regional Director .NET Practice Manager @ Ordina Trainer & speaker @gillcleeren gill@snowball.be
  • 4. I’m a Pluralsight author! • Courses on Windows 8, social and HTML5 • http://gicl.me/mypscourses
  • 5. Agenda • Overview of Xamarin and Xamarin.iOS • Preparing for iOS development • Xamarin.iOS fundamentals • TableViews in iOS • Adding navigation • Optimizing the application • Preparing for store deployment
  • 6. Targets of this talk • Understanding the fundamentals of iOS app development with Xamarin • See how a fully working app can be built
  • 7. The demo scenario • iOS Coffee Store Manager • List of coffee • Navigation to details page
  • 8. DEMO Looking at the finished application
  • 10. Hello Xamarin • Xamarin enables developers to reach all major mobile platforms! • Native User Interface • Native Performance • Shared Code Across Platforms • C# & .NET Framework • Toolset on top of Visual Studio • Enables VS to create native iOS and Android apps • Commercial product
  • 11. Write Everything in C# iOS, Android, Windows, Windows Phone, Mac Billions of Devices covered!
  • 12. The Xamarin platform Xamarin Xamarin.Android Xamarin.iOS Xamarin Forms
  • 13. Xamarin.iOS Anything you can do in Objective-C/Swift/XCode can be done in C# and Visual Studio (or Xamarin Studio) with Xamarin!
  • 14. iOS Runtime model • Native ARMx code – no JIT is being used here • Mono runtime provides system services such as Garbage Collection • Full access to iOS frameworks such as MapKit as well as .NET BCL
  • 15. A word on code-sharing • Xamarin brings development time through the use of code-sharing • Possible (currently!) using • Shared projects: • allows organizing the shared code • #if directives for platform specific code • PCL • “include” the platforms we want to support • Abstract to interfaces where platforms have specific implementations
  • 16. Target architecture for a Xamarin app
  • 17. Preparing for iOS development
  • 18. What you need for Xamarin.iOS development • Xamarin license (Xamarin.iOS) • PC or Mac or Mac only • Visual Studio or Xamarin Studio (Mac) • XCode SDK (free) • Optionally, a VM (VMWare or Parallels) with Windows 7 or 8 • Optionally, a device • Optionally, a developer account
  • 20. iOS development on Windows • Required: a Mac with latest OSX! • There are no iOS simulators on Windows! Windows Visual Studio Xamarin iOS plugin in Visual Studio Mac with OSX Xamarin Build Host iOS SDK XCode Interface Builder Device iOS Simulator
  • 22. Developing on the Mac? Xamarin Studio! • Optimized for cross-platform mobile development • Explore native APIs with code completion • World class Android and iOS designers • Powerful debugging on simulator or device
  • 23. DEMO A quick look at the development setup for Xamarin.iOS
  • 25. File  New Project
  • 26. File  New Project
  • 27. Fundamental #1: Application structure • Main.cs • Entry point of the application • Main app class is passed: AppDelegate • AppDelegate.cs • Main application class • Builds the window • Listens for OS events • MainStoryboard.storyboard • Visual design of the app and the flow between the screens
  • 28. Application structure • ****ViewController.cs • Powers the view of the app • View controller handles the interactions between the user and the view • ****ViewController.designer.cs • Auto-generated file • Glue between controls in the View and representations in View controller • Don’t edit this file yourself!
  • 29. Application structure • Info.plist • Property list file • Contains app properties such as app name, icons, splash screen images… • Entitlements.plist • Allows specifying with capabilities the app is receiving • PassKit, iCloud…
  • 30. Main.cs • Entry point for the application • Contains static Main • Creates the app • Passes name of application delegate
  • 32. Fundamental #2: Views & Storyboards • Views are most commonly created using a Storyboard • Alternatives: code or *.xib files (XCode) • Designer can be used to edit the Storyboard • A Storyboard is a file that contains the visual designs of our application’s screens as well as the transitions and relationships between the screens • A screen inside a Storyboard is a Scene • Each Scene represents a controller and the views it manages (content view hierarchy) • Most templates create a new storyboard automatically • An app can have more than one storyboard
  • 34. Auto-generation of the *.designer.cs file • Controller.cs contains our code • Handles all that happens in the View • Controller.designer.cs maps Storyboard controls to C# objects • Glue to make controls available in code • Never edit this file manually!
  • 36. Fundamental #3: Controllers • iOS apps follow MVC pattern • Actual code lives in View Controller classes • Each ViewController inherits from UIViewController • Different “base” view controllers exist • NavigationViewController • TabViewController • SplitViewController • …
  • 37. Linking the view and the view controller • When selecting a screen, we can select the black bar at the bottom • Points to the View Controller • Is an instance of UIViewController • “Code behind”
  • 38. Types of view controllers
  • 39. Handling events in the view controller • Controller needs to respond to user interaction • Button press, navigation… • We need to wire up code in the controller to listen for interaction with a control • To write code against controls, they are wired up in the *.designer.cs • From then, we can work with them in the controller classes • Controls are available for wiring up in the ViewDidLoad()
  • 40. Responding to user interaction
  • 41. DEMO Creating our first iOS application together!
  • 42. Adding a list using UITableView I’d like an app for this please.
  • 43. The UITableView • Lists of data can be visualized using the UITableView • Can also be used for detail screens • Contains cells (individual rows) • Can have index and grouping (headers and footers) • Can be placed in editing mode to allow data management • Similar to Android: works with intermediate: UITableViewSource
  • 44. Typical visualizations of the UITableView Plain Index Grouped Edit
  • 45. Participating classes • UITableView • UITableViewCell • UITableViewSource • UITableViewController
  • 46. Loading data in the UITableView • Each UITableView is assigned a UITableViewSource • Table queries the source to learn how it should be rendered • How many rows • How high are the rows (if not default) • Source supplies each cell view, populated with data • 2 methods are required to show data • RowsInSection • returns an int count of the total number of rows of data the table should display • GetCell • return a UITableCellView populated with data for the corresponding row index passed to the method
  • 47. DEMO Loading a list of data I’d like an app for this please.
  • 48. Changing the appearance of the cells • iOS comes with 4 built-in styles • We can create our own styles as well
  • 50. Using a built-in styles cell = new UITableViewCell (UITableViewCellStyle.Default, cellIdentifier); cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cellIdentifier); cell = new UITableViewCell (UITableViewCellStyle.Value1, cellIdentifier); cell = new UITableViewCell (UITableViewCellStyle.Value2, cellIdentifier);
  • 51. Creating your own cell layout • It’s possible to provide an entirely different cell • Different color • Different control layout • We need to create a new UITableViewCell • Implements • Constructor • Creates the UI controls and sets the custom style properties • UpdateCell • Method for UITableView.GetCell to use to set the cell’s properties • LayoutSubviews • Set the location of the UI controls • Possible to have more than one layout and create them based on content being displayed
  • 54. Navigation with the UINavigationController • NavigationController is a lookless controller (UINavigationController) • Is special type of UIViewController • Allows navigating from one screen to another • Doesn’t really manage a Content View Hierarchy • Instead manages other View controllers • + A specific, own view hierarchy including a navigation bar, title, back button… • VERY common pattern in iOS
  • 55. Navigation with the UINavigationController • Allows us to navigate to second screen • New views are pushed on the stack Add to stack
  • 56. Navigation with the UINavigationController • Can provide a back button on the title bar • Pops the current controller off the back stack • Loads previous one again Remove from stack
  • 57. The NavigationController • Automatically provides a title bar • Can be used to display controller title
  • 58. Concept of the root view controller • Navigation controller is lookless • Needs to be paired with a Root View Controller • Root view controller is first controller in the stack • Loads the first content view hierarchy into the window
  • 59. Actual navigation: Segues • Navigation/transition to another view is done (mostly) through the use of Segues (pronounced Segways) • Shown using arrow between views • A storyboard can contain a segue with no source: Sourceless segue • This view will get loaded when the application starts
  • 60. Actual navigation: Segues • Adding segues can be done in the storyboard designer • Gives choice of desired action
  • 61. Passing data with segues • PrepareForSegue is called before transition is executed • We can access the next view controller using the DestinationViewController property on the Segue
  • 62. DEMO Adding a second screen and navigation
  • 66. Icon sizes • Icons (and other images) are required to be added in different resolutions iOS 5/6 iOS 7/8 iOS 8 (6plus) 1x 2x 1x 2x 3x App icon 57x57 114x114 Not supported 120x120 180x180 Spotlight 29x29 58x58 80x80 120x120 Settings 29x29 58x58 - - 87x87
  • 70. Deploying your apps to the store • Store deployment involves 3 major parts • Provisioning • Creating a profile that includes code-signing information used to publish the app • iTunes Connect information settings • Online tool to add information that will be used for the application’s page in the App Store • Application Submission • Signed binary can be uploaded to Apple for review • Will be published in the store soon after that
  • 71. Things to do before submitting • App needs to meet Apple’s guidelines for quality and content • Can be rejected • Must be fixed and resubmitted • Guidelines can be found at https://developer.apple.com/app- store/review/guidelines/ • Test the app for crashes under normal circumstances • Make sure the description matches what the app does!
  • 72. Summary • Xamarin.iOS leverages your C# knowledge to build apps for Android • iOS is further from regular .NET development • Getting your head around UI paradigms will take time!
  • 74. Q&A
  • 75. Building your first iOS app using Xamarin Gill Cleeren - @gillcleeren
  • 76. Your feedback is important! Scan the QR Code and let us know via the TechDays App. Laat ons weten wat u van de sessie vindt via de TechDays App! Scan de QR Code. Bent u al lid van de Microsoft Virtual Academy?! Op MVA kunt u altijd iets nieuws leren over de laatste technologie van Microsoft. Meld u vandaag aan op de MVA Stand. MVA biedt 7/24 gratis online training on-demand voor IT- Professionals en Ontwikkelaars.