ebook img

Xamarin 4.x cross-platform application development develop powerful cross-platform applications with Xamarin PDF

282 Pages·2016·11.034 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Xamarin 4.x cross-platform application development develop powerful cross-platform applications with Xamarin

Xamarin 4.x Cross-Platform Application Development Third Edition Develop powerful cross-platform applications with Xamarin Jonathan Peppers BIRMINGHAM - MUMBAI Xamarin 4.x Cross-Platform Application Development Third Edition Copyright © 2016 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: February 2014 Second edition: February 2015 Third edition: December 2016 Production reference: 1221216 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78646-541-2 www.packtpub.com Credits Author Copy Editor Jonathan Peppers Safis Editing Reviewer Project Coordinator Esteban Solano Granados Devanshi Doshi Commissioning Editor Proofreader Ashwin Nair Safis Editing Acquisition Editor Indexer Reshma Raman Tejal Daruwale Soni Content Development Editor Graphics Narendrakumar Tripathi Jason Monteiro Technical Editor Production Coordinator Anushree Arun Tendulkar Aparna Bhagat About the Author Jonathan Peppers is a Xamarin MVP and lead developer on popular apps and games at Hitcents such as the Hanx Writer (for Tom Hanks) and the Draw a Stickman franchise. Jon has been working with C# for over 10 years working on a wide range of projects at Hitcents. Jon began his career working Self-Checkout software written in WinForms and later migrated to WPF. Over his career, he has worked with many .NET-centric technologies such as ASP.Net WebForms, MVC, Windows Azure, WinRT/UWP, F#, and Unity3D. In recent years, Hitcents has been heavily investing in mobile development with Xamarin, and has development over 50 mobile applications across multiple platforms. I would like to thank my wife, Amy Kate, and my son, Levi, for giving me the free time to write this book. You are both my inspiration and "why I do what I do". About the Reviewer Esteban Solano Granados is a senior software engineer, Microsoft and Xamarin MVP from Cartago, Costa Rica and he enjoys learning, talk, and help others to learn about software development for the web and mobile by using his knowledge of JavaScript and C# with Xamarin, Asp.Net, NodeJS and other technologies. www.PacktPub.com For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. https://www.packtpub.com/mapt Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via a web browser Customer Feedback Thank you for purchasing this Packt book. We take our commitment to improving our content and products to meet your needs seriously—that's why your feedback is so valuable. Whatever your feelings about your purchase, please consider leaving a review on this book's Amazon page. Not only will this help us, more importantly it will also help others in the community to make an informed decision about the resources that they invest in to learn. You can also review for us on a regular basis by joining our reviewers' club. If you're interested in joining, or would like to learn more about the benefits we offer, please contact us: [email protected] Table of Contents Preface 1 Chapter 1: Xamarin Setup 7 Understanding Xamarin 8 Installing Xcode 10 Installing Xamarin on Mac OS X 11 Setting up the Android emulator 12 Installing Xamarin on Windows 14 Connecting Visual Studio to a Mac for iOS development 16 Enrolling in the iOS developer program 17 Registering as a Google Play developer 19 Summary 22 Chapter 2: Hello, Platforms! 23 Building your first iOS application 24 Understanding Apple's MVC pattern 28 Using the iOS designer 29 Building your first Android application 35 Understanding Android activities 38 Xamarin's Android designer 42 Summary 46 Chapter 3: Code Sharing Between iOS and Android 47 Learning the MVVM design pattern 48 Comparing project organization strategies 51 Setting up a shared project 53 Working with portable class libraries 55 Using preprocessor statements 56 Simplifying dependency injection 58 Implementing Inversion of Control 60 Summary 63 Chapter 4: XamSnap - A Cross-Platform App 64 Starting our sample application concept 64 Developing our model layer 65 Writing a mock web service 67 Writing the ViewModel layer 73 Implementing our LoginViewModel class 74 Implementing our RegisterViewModel class 75 Implementing our FriendViewModel class 76 Implementing our MessageViewModel class 78 Writing unit tests 81 Setting up a new project for unit tests 81 Writing assertions 82 Summary 87 Chapter 5: XamSnap for iOS 88 Understanding the basics of an iOS app 88 Xamarin.iOS Build Options 91 Using UINavigationController 93 Implementing the login screen 94 Using segues for navigation 100 Setting up UITableView 102 Adding a friends list screen 105 Adding a list of messages 109 Composing messages 113 Summary 116 Chapter 6: XamSnap for Android 117 Introducing the Android Manifest 117 Setting up Material Design 121 Adding a login screen 124 Using ListView and BaseAdapter 128 Implementing the friends list 132 Composing messages 137 Summary 145 Chapter 7: Deploying and Testing on Devices 146 iOS provisioning 147 Android device settings 152 Understanding the linker 154 Understanding AOT compilation 156 Avoiding common memory pitfalls 158 Summary 162 Chapter 8: Contacts, Camera, and Location 163 Introducing Xamarin.Mobile 163 Accessing contacts 165 [ ii ]

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.