Why We Wrote This Book
This book is a practical cross-reference for iOS and Android native development. By native we mean the original, provided toolsets for each platformSwift and Cocoa for iOS, and Java or Kotlin with the Android Open Source Project (AOSP) software development kit (SDK) for Android.
We were motivated to write this book out of common need. Both authors have experience with both platforms but specialize in one. Members of our team (including ourselves) would find themselves working on a problem we encountered in one platform, determine a solution to that problem in that platform, and then need to share that solution with the team members working on the other platform.
Often, these were common tasks like reading or writing to or from a database or files, making a network connection, or showing user feedback in a way thats familiar to users. When we started codifying and documenting these tasks, in both platforms, it quickly became apparent that a very large majority of application code fell into one of these categorizations and that a reference source for all of them could be valuable to teams with a similar makeup, teams starting a transition to another platform, or even developers who wanted to start learning both platforms at the same time.
We hope that this book will provide that resource for the most common mobile development tasks to its readers.
Having an entire team of mobile developers with varying levels of cross-platform experience, we were able to manage this pretty well, but the idea of a cross-reference came up a lot, yet theres really nothing currently available that provides the breadth we think is necessary. We could only imagine the frustration a sole developer in the same situation might experience; this book allows anyone to learn the basic approach to most of the common tasks in application development for both platforms. Each task chapter shows the entire process for the task in both Android and iOS with human-readable walk-throughs of the code samples. We would posit that the samples cover 80% of the basic knowledge required to start off in app development; of course the reader is expected to maintain and update their knowledge and read documentation for what we dont specifically cover, but weve included a start-to-finish application walk-through as well. This sample app demonstrates how to successfully accomplish virtually everything needed by a modern app, using the task cross-reference provided earlier.
Since all Android code examples are provided in both Java and Kotlin, this book has a pleasant side effect of allowing Android developers the same type of cross-reference between Java and Kotlin as cross-platform developers enjoy between iOS and AOSP.
The code samples are not pseudo-code; they are written in the suggested languages and should all compile and function as described.
Who This Book Is For
This book is for any native programmer working either exclusively with a single platform or with both, or familiar with one but needing to have some ability with the other. We assume at least a passing familiarity with some programming language. You dont have to be an expert with Java or Swift, but having some UI programming background is helpful.
You may need to refer to official documentation for Objective-C, Swift, Java, or Kotlin to understand some basic language mechanics referenced within this book.
Programmers coming from one framework (iOS- or Android-native development) should have an especially easy time consuming the information provided because almost all code examples are presented with functional equivalence in the complimentary framework (Android for iOS, and vice versa).
How This Book Is Organized
This.
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Tip
This element signifies a tip or suggestion.
Note
This element signifies a general note.
Warning
This element indicates a warning or caution.
Using Code Examples
Supplemental material (code examples, exercises, etc.) is available for download at https://github.com/oreillymedia/native-mobile-development.
This book is here to help you get your job done. In general, if example code is offered with this book, you may use it in your programs and documentation. You do not need to contact us for permission unless youre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission .