WWDC19: Preventing Bugs with Flawless Debugging in Xcode11

Published by Shashikant Jagtap on

Xcode 11 brings some amazing features, the whole list of new features can be found at the release notes of the Xcode 11. Some of the notable ones are SwiftUI framework and integration of the Swift Package Manager inside the Xcode. On top of that, there are few enhancements in the debugging as well. In this post, we will cover some of the new things announced for debugging in the Xcode11.

Live Preview

In Xcode1, you can get the live preview of the SwiftUI app, Xcode will show the changes dynamically in the other editor side by side if the editor and canvas options selected from the editor area. You can watch the changed in the source code on the fly into the Xcode preview. This feature is similar to the hot reloading from React Native or Flutter.

You can start and stop preview using the play button in the preview area. This feature will allow the developer to see the changes in demand in preview rather than waiting for Xcode to finish build. This was one of the missing features from native app development but glad that developers will get that from Xcode 11 onwards. The app developers can found issues during the development phase as developers can see the live preview of the app how it looks like.

Device Conditions

In Xcode11, Device Conditions is a new way to debug apps with the conditions that can not be easily available in the development environment. Most of the issues in the apps found when the device is in specific condition e.g low battery power, limited network etc. Device conditions features allow replicating these condition from the development environment. In order to debug the app with Device conditions, you need to attach the device to the Xcode process.

Network Link Conditioner

Network Link Conditioner was available in from the simulator but with Device condition, we can get this feature in the Xcode organiser. You can get a different profile with high latency, low bandwidth, high packet loss, slow network etc. This feature allows developers and QA engineer to easily find run-times issues while development.

Thermal State

In the real world, users might be using the apps in the different thermal state, users devices might be warm or other elevated states. While development, it’s very hard to reproduce these situations. With thermal state feature in Xcode11, you can attach the device and set the thermal state while development. There are some profiles available to set thermal state. When the device is attached and set to critical profile, the attached device doesn’t get affected e.g not become hot.

Device conditions are managed by Xcode and available on all the platforms. With the device conditions features in Xcode11, developers can set the state of the device with a real-life situation to build and test apps to avoid the run-time issues.

Environment Override

In iOS13, there is dark mode introduced so developers have to consider the apps in both modes. When the app stopped at the breakpoint in the Xcode, developers will another option of environment variables. With Environment Override, there are options from switching between dark mode to normal mode as well load of accessibility settings.

The changes can be reflected on the fly so environment override is the great option to test the app for accessibility errors. This also gives an opportunity to fix potential issues in the dark mode.

Conclusion

With Device Conditions and Environment Override features, developers can avoid lots of runtime issues while development. Get Xcode11 and try all those amazing features. To know more about the debugging in Xcode 11, watch this WWDC 2019 session.