Book Image

Mastering iOS 12 Programming - Third Edition

By : Donny Wals
Book Image

Mastering iOS 12 Programming - Third Edition

By: Donny Wals

Overview of this book

The iOS development environment has significantly matured, and with Apple users spending more money in the App Store, there are plenty of development opportunities for professional iOS developers. However, the journey to mastering iOS development and the new features of iOS 12 is not straightforward. This book will help you make that transition smoothly and easily. With the help of Swift 4.2, you’ll not only learn how to program for iOS 12, but also how to write efficient, readable, and maintainable Swift code that maintains industry best practices. Mastering iOS 12 Programming will help you build real-world applications and reflect the real-world development flow. You will also find a mix of thorough background information and practical examples, teaching you how to start implementing your newly gained knowledge. By the end of this book, you will have got to grips with building iOS applications that harness advanced techniques and make best use of the latest and greatest features available in iOS 12.
Table of Contents (35 chapters)
Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
Index

Chapter 2. A Better Layout with UICollectionView

The previous chapter showed you how to build a list of items using a table view. In this chapter, you'll learn how to display the same items using a more flexible component. This component is called UICollectionView, and it has a very similar interface to UITableView. The most significant difference is that you can define a much more flexible layout using a collection view. An example of this is the grid layout that UICollectionView provides out of the box. Of course, you are free to implement any layout you want for a collection view. This is probably the most significant advantage a collection view has to offer.

You will build on top of Hello-Contacts by refactoring the existing application to switch from a table view to a collection view. You are going to replace all table-view-related configuration code with its collection view counterparts. You will also make use of a grid layout to show contacts. Lastly, you will create a custom collection...