The new AppleTV comes packed with a new tvOS (which is similar to iOS) that allows developers to build apps to target the new devices AppStore. I thought it would be an interesting experiment to see whether the current version of Xuni iOS would work in this environment and document some of the process.

AppleTV and tvOS


I’ve been very curious about the new AppleTV since it launched last month with its new AppStore. As an owner of a previous version of the AppleTV, I already had a fondness for the simple interface and easy access. I’d even dabbled with jailbreaking the device to open it up to a wealth of outside applications that realized further potential beyond what Apple was then providing. When Apple announced its new tvOS this year, I was quite excited by the prospect, since it seemed like Apple was finally willing to open up the platform a bit.

Unlike Apple’s WatchOS 2.0, tvOS doesn’t deviate a lot from what’s available in iOS. Most of the same frameworks are present (there’s a large amount of information on the topic in their documentation), including UIKit, which is partially what initially triggered my curiosity about using Xuni in the new OS and the pontential for it to work.

Initial Trial Project


XCode 7 already has some templates available for tvOS applications when you create a new project. Since this is going to be a relatively simple test, I picked the option for a Single View Application.

Single View Application in Xuni Apple TV

The project looked very similar to an iOS project, with the exception of a slightly different-looking storyboard and assets. Otherwise, things are much the same. Adding the Xuni frameworks to the project is the same familiar process, and it didn’t seem to cause any immediate problems.

tvOS project with Xuni

At this point it made sense to test whether licensing would work since this would make or break the ability to use any Xuni control. After adding the License class and setting the key in the AppDelegate I was able to build successfully with some warnings:

tvOS Build with Xuni

Testing the Controls



Now seemed like a good opportunity to add some Xuni controls to the ViewController to see what kind of output I’d get. I started with our Gauge controls, since they’re the both the simplest and most likely to work. After adding a little bit of code to the ViewController and running the application, I was greeted by a visible linear gauge:

tvOS Xuni Linear Gauge

Since the basic gauges seemed to work, I figured I’d move onto the more complicated FlexPie to see if I could get the PieCharts to work. After adding a class to generate some dummy data and making a few changes to the ViewController, I was once again pleasantly surprised to find FlexPie working:

tvOS Xuni FlexPie

FlexChart shares the same dependencies as FlexPie, which means it also should work without too much issue. After a few small changes I was able to confirm that it also worked:

tvOS Chart Xuni FlexChart

The only control left to check at this point is FlexGrid, which is also probably the most complicated control. After I’d added an import statement to my ViewController I was greeted with an error:

tvOS grid Xuni FlexGrid

I was able to disable modules in the project build settings, which gave me some more descriptive errors:

tvOS Xuni FlexGrid Errors

FlexGrid has some dependencies which are unavailable in tvOS that prevents us from being able to use it in our project. Some of the UI elements that it depends on are not present in tvOS, so it’s not possible to use it in our application at this time. This does highlight the fact that, although iOS and tvOS share many frameworks, not everything will be the same.

Caveats of the Process



There are caveats to this experiment to note: Since Xuni is built around touch interactions on iOS, these controls will all basically exist statically; tvOS interactions are built around using the AppleTV remote and navigating a focus chain. In addition, though I'm able to build this application, and run it on the simulator, there are quite a few warnings present in this project:

tvOS Xuni warnings

These warnings basically call out the fact that Xuni has not been built for tvOS, and, though it’s working at the moment, it will need to be built for tvOS to guarantee that it works in the future.

Concluding the Experiment



It's fun to see Xuni working on tvOS, and interesting to see what aspects work and what does not. While we're not going to pronounce support for tvOS it is interesting to see how close the controls come without any kind of modifications. In the future we'll consider this further, but right now Xuni for tvOS is simply a fun experiment.

Read more about Xuni iOS >>