Download - Introduction to iOS 9 (Xamarin Evolve 2016)
![Page 1: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/1.jpg)
Introduction to iOS… 9Craig DunnXamarin@conceptdev
![Page 2: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/2.jpg)
On the menu?File New App How it works iOS 9
Configuration UI design C# code
![Page 3: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/3.jpg)
![Page 4: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/4.jpg)
File > New
![Page 5: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/5.jpg)
iPad Multitasking
-‐ Adaptive layout -‐ Size classes -‐ Configuration: + LaunchScreen.storyboard + support all iPad orientation options
![Page 6: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/6.jpg)
How it works
![Page 7: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/7.jpg)
Xamarin’s Unique Approach
iOS C# UI
Windows C# UI Android C# UI
Shared C# Code
github.com/xamarinhq/app-‐acquaint
![Page 8: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/8.jpg)
Under the Hood Bonnet
Native UI
Storyboards & XIBs User Interface code (﴾C#)﴿
UIKit, MapKit, CoreLocation…
Shared C# Code • Business Logic • Database • Web services • File operations
cust
om
bind
ings
Mono (﴾.NET Framework)﴿ • System.Net
CocoaPods Objective-‐C
NSUrlSession SQLite
iOS
iOS C# UI
Windows C# UI Android C# UI
Shared C# Code
Xamarin
![Page 9: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/9.jpg)
System.Net
Choose the Mono managed or the native iOS network stack for WebClient & HttpClient
*
*
![Page 10: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/10.jpg)
Application Transport Security
-‐ HTTPS “just works” -‐ HTTP exceptions
-‐ HTTP opt-‐out
![Page 11: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/11.jpg)
Native Performance
Xamarin.iOS does full Ahead Of Time (﴾AOT)﴿ compilation with LLVM to produce an ARM binary for Apple’s App Store.
![Page 12: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/12.jpg)
Shine with iOS 9
![Page 13: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/13.jpg)
iOS 9
-‐ UIStackView & Localization -‐ Core Spotlight -‐ NSUserActivity / Handoff -‐ Universal linking -‐ 3D Touch + Quick Actions
![Page 14: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/14.jpg)
UIStackView
![Page 15: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/15.jpg)
UIStackView
Horizontal & vertical orientation
Leading and Trailing (﴾not Left and Right)﴿
![Page 16: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/16.jpg)
UIStackView & Localization
![Page 17: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/17.jpg)
Localization Configuration
<key>CFBundleLocalizations</key> <array> <string>de</string> <string>es</string> <string>ja</string> <string>he</string> <string>ar</string> </array> <key>CFBundleDevelopmentRegion</key> <string>en</string>
Info.plist
![Page 18: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/18.jpg)
Localized Content
![Page 19: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/19.jpg)
Localized Content
![Page 20: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/20.jpg)
Localization
![Page 21: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/21.jpg)
Core Spotlight
![Page 22: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/22.jpg)
Core Spotlight (﴾Search)﴿public override void Index (Task t) { var attributeSet = new CSSearchableItemAttributeSet (UTType.Text); attributeSet.Title = t.Name; attributeSet.ContentDescription = t.Notes; attributeSet.TextContent = t.Notes; var dataItem = new CSSearchableItem (t.Id.ToString(), "co.conceptdev.to9o", attributeSet); }
// delete items CSSearchableIndex.DefaultSearchableIndex.Delete (new string[] {t.Id.ToString()}, err => {}) // index all-at-once (for reference material) var dataItems = new List<CSSearchableItem>();foreach (var session in sessions){ Index (session); }
![Page 23: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/23.jpg)
Responding to Search
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { // Take action based on the activity type if (userActivity.ActivityType == CSSearchableItem.ActionType) { var uuid = userActivity.UserInfo.ObjectForKey (CSSearchableItem.ActivityIdentifier); ContinueNavigation (); // custom implementation }
![Page 24: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/24.jpg)
NSUserActivity / Handoff
![Page 25: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/25.jpg)
NSUserActivity / Handoff
![Page 26: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/26.jpg)
Creating NSUserActivity for Handoff
<key>NSUserActivityTypes</key> <array> <string>my.custom.identifier.add</string> <string>my.custom.identifier.edit</string> </array>
Info.plist
![Page 27: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/27.jpg)
Creating NSUserActivity for Handoff
var activity = new NSUserActivity ("my.custom.identifier.add")(;activity.EligibleForSearch = false; // don’t use this _and_ CoreSpotlightactivity.EligibleForPublicIndexing = false; activity.EligibleForHandoff = true; activity.Title = "Todo Detail";
var attributeSet = new CoreSpotlight.CSSearchableItemAttributeSet (); attributeSet.DisplayName = "Add Todo"; attributeSet.ContentDescription = NSBundle.MainBundle.LocalizedString ("(new)",""); activity.AddUserInfoEntries (NSDictionary.FromObjectAndKey(new NSString("0"), ActivityKeys.Id));
activity.ContentAttributeSet = attributeSet; activity.BecomeCurrent (); // ViewWillDisappear: don’t forget to ResignCurrent()
ViewController
![Page 28: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/28.jpg)
Responding to NSUserActivity
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { // Take action based on the activity type if (userActivity.ActivityType == "my.custom.identifier.add") { var uuid = userActivity.UserInfo.ObjectForKey (CSSearchableItem.ActivityIdentifier); ContinueNavigation (); // custom implementation }; }
AppDelegate
![Page 29: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/29.jpg)
Universal Links
Deep link into your app
Great for search, mail-‐outs
https://evolve.xamarin.com/session/56f441a3de91c6253c277bf6
![Page 30: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/30.jpg)
Set up Universal Links
https://evolve.xamarin.com/apple-‐app-‐site-‐association { "applinks": { "apps": [], "details": [ { "appID": "XXXX421985.com.xamarin.evolve", "paths": [ "/session/*" ] } ] } }
Entitlements.plist
App ID
apple-‐app-‐site-‐association
![Page 31: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/31.jpg)
Responding to Universal Links
public override bool ContinueUserActivity (UIApplication application, NSUserActivity userActivity, UIApplicationRestorationHandler completionHandler) { if (userActivity.ActivityType == NSUserActivityType.BrowsingWeb) { var data = userActivity.WebPageUrl.AbsoluteString; if (string.IsNullOrWhiteSpace (data) || !data.Contains ("/session/")) return true; var id = data.Substring (data.LastIndexOf ("/", StringComparison.Ordinal) + 1); ContinueNavigation (); // custom implementation } }
AppDelegate
![Page 32: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/32.jpg)
3D Touch Quick Actions
Info.plist
![Page 33: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/33.jpg)
Responding to Quick Actions
public UIApplicationShortcutItem LaunchedShortcutItem { get; set; } public override void OnActivated (UIApplication application) { HandleShortcutItem(LaunchedShortcutItem); LaunchedShortcutItem = null; } public override void PerformActionForShortcutItem (UIApplication application, UIApplicationShortcutItem shortcutItem, UIOperationHandler completionHandler) { // app already running var handled = HandleShortcutItem (shortcutItem); completionHandler (handled); } public bool HandleShortcutItem (UIApplicationShortcutItem shortcutItem) { // show required view controller }
AppDelegate
![Page 34: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/34.jpg)
Xamarin.Forms too!
Evolve app: -‐ Core Spotlight -‐ NSUserActivity -‐ Universal Linking -‐ 3D Touch Quick Actions
EVOLVE APP!!
![Page 35: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/35.jpg)
VISUAL STUDIO
one more thing…
![Page 36: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/36.jpg)
Visual Studio on Windows Storyboards
![Page 37: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/37.jpg)
Visual Studio on Windows iOS Simulator
![Page 38: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/38.jpg)
Visual Studio on Windows USB Remoting
![Page 39: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/39.jpg)
Sample Codegithub.com/conceptdev/xamarin-‐ios-‐samples > Traveller (﴾iOS)﴿ github.com/conceptdev/xamarin-‐ios-‐samples > To9o (﴾iOS)﴿
github.com/xamarin/xamarin-‐forms-‐samples > Todo (﴾Xamarin.Forms)﴿ github.com/xamarinhq/app-‐evolve > Evolve (﴾Xamarin.Forms)﴿
github.com/nishanil/TouristAttractions > Android app (﴾@nishanil)﴿
![Page 40: Introduction to iOS 9 (Xamarin Evolve 2016)](https://reader034.vdocuments.site/reader034/viewer/2022042517/5883931b1a28ab2b568b4587/html5/thumbnails/40.jpg)
Craig DunnXamarin
@conceptdev
THANK YOU!