Top tips for developing multitasking apps

Default Blog Image of logo on blue
If you're looking at developing a multitasking app, there are a few issues you need to consider, as our colleague Rhys has been discovering.

Don't let constraints tie you down

In our busy and increasingly connected lives, we want to do more. In fact, we want to do about twenty things at once; eat breakfast, read Twitter, feed the cat, check the football scores - all without breaking a sweat.

So it’s not surprising that we’re demanding ever greater multitasking abilities from our apps. For developers this poses a number of challenges around constraints, and a particularly interesting one came to light recently when we were working on an income calculator app for one of our clients.

The thin blue lines

While we were developing the app interface, we found that constraints remain installed after uninstalling the UI Element that they belong to. If you don’t already know, uninstalling a UI Element doesn’t automatically uninstall its constraints. This is because multitasking maintains the constraint in case the app enters a mode where it will be needed.

If the user enters multitasking mode on the iPad, for example, the size class could change which would impact functionality. If a UIElement or a constraint is uninstalled, the constraint is still initiated if the priority of that constraint is 1000 (required).

This can be broken which will cause problems if the app enters a state where that constraint is needed. A way to work around this problem is to lower the priority of the constraint. Let’s take a look:

In this image, the highlighted constraint (width of the Press me button) is equal to 600 and has a priority of 1000. It is also uninstalled on devices that are of compact width. Let’s see what happens:

As you can see, we get many constraints that the device cannot satisfy and it breaks the width constraint of the Press me button, even though it is not installed. This means that if the app changes size class, that constraint would now be broken. However if we lower the priority, the constraint will no longer be broken - problem solved.

Banish the bugs

Another interesting discovery we made with this app is when uninstalling UI Elements, the default setting must show that the element is installed. By this I mean the setting on top must be checked and underneath unchecked, as you can see in the screenshot below:

If it’s the other way around, it has the potential to introduce bugs into your app, which may be a fault that gets fixed in the future. To make sure we don’t forget this at Brightec, we’ve now adopted the policy of hiding rather than uninstalling UI Elements. We feel that this is a much safer approach.

I hope this helps you when you’re developing your own multitasking apps. You can search for a wealth of other developer tips and expertise on the rest of our blog, so check out our other posts.

Looking for something else?

Search over 400 blog posts from our team

Want to hear more?

Subscribe to our monthly digest of blogs to stay in the loop and come with us on our journey to make things better!