Mastering Kotlin
Learn advanced Kotlin programming techniques to build apps for Android, iOS, and the web
Nate Ebel
BIRMINGHAM - MUMBAI
Mastering Kotlin
Copyright 2019 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 or its dealers and distributors, will be held liable for any damages caused or alleged to have been 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.
Commissioning Editor: Richa Tripathi
Acquisition Editor: Karan Gupta
Content Development Editor: Tiksha Sarang
Senior Editor: Rohit Singh
Technical Editor: Romy Dias
Copy Editor: Safis Editing
Project Coordinator: Prajakta Naik
Proofreader: Safis Editing
Indexer: Priyanka Dhadke
Production Designer: Nilesh Mohite
First published: October 2019
Production reference: 1111019
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-83855-572-6
www.packtpub.com
To my wife, for being a constant source of support and encouragement, and for being understanding during all the late nights and early mornings; I couldn't have finished this book without you. To my parents, for always believing in me and teaching me to do the same, and for raising me to dream big; I wouldn't be here without you. To the educators, mentors, and friends over the years: Steve, Steve , Shawn, and Scottthe kindness, encouragement, knowledge, and support you've given me will never be forgotten.
Packt.com
Subscribe to our online digital library for full access to over 7,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Fully searchable for easy access to vital information
Copy and paste, print, and bookmark content
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.packt.com and, as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.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.
Contributors
About the author
Nate Ebel is a software developer who enjoys building great software and helping others do the same. He has worked with Android since its early days, across a variety of projects, from creative and educational apps, mapping and navigation applications, to the evolution of robotic controllers.
Nate has a passion for technology, education, and software development, and enjoys opportunities to combine the three. He enjoys being involved in the Android developer community and is an active contributor through conference speaking, blogging, and event organizing.
He is working to help himself and others dream, learn, and create in an effort to positively impact others.
About the reviewer
Ashok Kumar Srinivas is a Google-certified Android developer from Bengaluru, India. He is an expert in the web and mobile engineering domains. He has authored books on Android Wear and Firebase, and has reviewed books on subjects including web and mobile applications. He is one of the top open source contributors. He is a passionate YouTuber and runs a channel called AndroidABCD. He is also a speaker at international conferences. He has a keen interest in the quality, architecture, and unit testing of the code. When he can find the time, he writes and reviews books. He also likes to travel inside India and further afield.
I would like to thank T. Subhash Chandra, my teacher in college and life. He has been an incredible support for a diverse range of students, and I am proud to say that I am one such student. I would also like to thank my wife, Geetha Shree Ashok, for supporting me in every way during my work on this book. I would also like to thank my sister, Shylaja Shripathi, my father, Srinivas, my mother, Lalitha, and my entire family.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
This book is written for software developers looking to expand their experience and understanding of the Kotlin programming language. It aims to bridge the gap between simple, practical examples and advanced language topics.
This book is designed to not only demonstrate how to write code in Kotlin, but to help you to understand the history of Kotlin and some of the motivations behind the language itself. Additionally, the book will demonstrate how features of the Kotlin language work behind the scenes. The goal is to help you to more fully understand Kotlin as a whole, rather than just as a language syntax.
Once a strong introduction to Kotlin and its features has been covered, the book will spend several chapters exploring a variety of more advanced topics, including how to build with Kotlin on a variety of platforms. These chapters aim to act as a quick-start guide for understanding what is possible with Kotlin and where and how you can apply the Kotlin language skills that you have learned for the development of real-world applications.
Who this book is for
This book is aimed at beginner and intermediate Kotlin developers who are looking to improve their understanding of the language, as well as experienced Java developers looking for simple, practical examples of how to solve familiar problems using Kotlin. You should be familiar with object-oriented programming and have some familiarity with Java.
Next page