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

Gaining insights through code coverage


Code Coverage is a tool in Xcode that is used to gain insights into how much of your code you are testing with your test suite. It tells you exactly which parts of your code were executed during a test and which parts of your code were not. This is extremely useful because you can take focused action based on the information provided by Code Coverage.

 

To enable Code Coverage, open the scheme editor through the (Product | Scheme) menu:

Select the Test action and make sure the Gather coverage checkbox on the Options tab is checked:

Note

You can also press Cmd + to open the scheme editor quickly.

After doing this, close the scheme editor and run your tests. This time, Xcode will monitor which parts of your code were executed during this test, and which parts weren't. This information can give you some good insights about which parts of your code could use some more testing. To see the coverage data, open the Report navigator in the left sidebar in Xcode...