The new tvOS and how developers can take advantages of its changes

Matheus Oliveira
Academy@EldoradoCPS
4 min readJul 2, 2020

With last week WWDC2020, we were surprised with some features on the new tvOS 14. One of the most exciting news was the multiuser feature for games.

Introduced on the last version, the multiuser feature enables the Apple TV to be used by different profiles. In that way, each user can have their own personalized recommendations and Up Next list in Apple Music, access their purchased apps in the App store, or play games with their Apple Arcade subscription.

Now with the new tvOS 14, the user will also be able to access their own games progress and records based on their profile. Wich can bring some ideias for developers to play with, like enabling the possibility of users custom interfaces in games and also saving users games configurations, such as accessibility options, for example.

Talking about accessibility, another feature added on the operation system was the compatibility with the Xbox Adaptive controller. Now games developers should be, more than ever, inspired to enhance their games accessibility options.

Person using the Xbox Adaptive controller to play video game. Fonte: xbox.com

But how can I manage user profiles in my app? The great part is that you don't need a large amount of code to support multiuser, the XCode does all the hard work for you! In the Signing & Capabilities pane of the project editor, simply add the "User Management" capability on your app with the "Run as Current User" checked, and you're good to go.

An important fact is that, once the user switch his profile, your app will be terminated and relaunched with the configurations of the new user. So, when working with multiuser we need to make sure that all the app current status will be saved before this action.

This can be easily done by implementing the applicationWillTerminate(_:) in the AppDelegate.swift and calling, inside it, the functions you use to store data. That way, when your app will be terminated, this method is called and your data is stored.

NOTE: As the user switch is an action that shouldn't take so long to be completed, we have a limited time to run this function. So make sure to only save essentials parts and as fast as possible. 😉

As a colorblind person, I would love to have my games settings saved so I don’t need to configure it all over again on my next gaming session. Thinking about it, I developed a really simple matching game app to demonstrate how useful this multiuser feature can be.

The ideia was to have an account with the colorblind mode off, and another one with the this setting turned on. To do so, I used the NSUbiquitousKeyValueStore swift class to easily store this setting at the user's iCloud. That way, with a few lines of code I can load this information when the game is started:

And save this setting changes when the user clicks in the eye button:

That's it! Easy right?! This is what the final app looks like:

Game with the default setting. Accessed by my dad, Cleudson.
Game with the colorblind mode turned on. Accessed from my account.

Conclusions

It's crazy how a simply new feature in the tvOS can bring us so many ideias on how to improve our apps experience don’t you think? Although this might seem like a small improvement, I bet that with this update we are going to have a whole new set of interesting apps waiting for us.

--

--

Matheus Oliveira
Academy@EldoradoCPS

Student at Apple Developer Academy. I like emojis and to code things 👨🏻‍💻