Hey #rockstars!

I am really excited today to show you what I have been working on over the last few weeks as part of the work on my bachelor thesis with the help of my colleague Daniel Maaß, UX Specialist at LOVOO.

Apple TV

Apple TV is Apple’s newest device running iOS or, as they call it, tvOS. LOVOO naturally had to consider what could possibly be a great experience for our users. As Apple TV is used by many different people, the purpose cannot be something too personalized. But since LOVOO offers the best way to meet new people, each purpose would be personalized.

Functionality

The next step was to find a purpose that was more of a supplement to the great LOVOO mobile apps. The radar would be awesome but the Apple TV is not able to detect the user’s current location. The chat feature would be great as well, but most people don’t have a keyboard connected to the Apple TV and Apple does not offer the possibility of retrieving text from the system’s voice recognition. Furthermore, both radar and chat are much more functional when opened both at home and on the way there.
Match is a really great way to find new interesting people nearby. Match can also be played at home, and to be honest, what could be better than playing Match and finding new people from the comfort of your couch or while sitting around the TV with your friends and having fun?
Implementing LOVOO Match for Apple TV was quite easy since it does not use a special SDK, but rather the established SDK for iOS. This means that we were able to use almost all of our code from the existing iOS-app modules. For a more scientific approach, I decided to rewrite the complete app from scratch in order to utilize the awesome advantages of Swift.

Swift is awesome!

As an example, the endpoints of our network library use Swift’s extremely powerful enum structure. These enums are not just limited options for a specific classification, but rather exclusively custom data types that can even store values. The endpoints are therefore defined as follows:

enum LVTVNetworkEndpoint {
case Match(limit: Int)
case Vote(userID: String, vote: LVTVVoteType)
case UserSelf
case LoginGenerateCode
}

As you can see, the caller of a network request does not have to worry about setting the right request headers or post-parameters. This is all done where it should be done – inside the network stack. The parameters belong to the enum cases and the program would not even compile if the parameters are not set or are in the wrong type.
Just when you thought it couldn’t be any more impressive, the network handler of the new Swift implementation is only about 100 lines. Even if this is not a fair comparison, the network handler in the existing Objective-C implementation of LOVOO is about 5,000 lines.

The most minimalist login process

The app consists of two major modules. The first one is responsible for the login of the user. The second one is the main part that makes most of the fun: the Match game itself. As LOVOO will find the best people matching your interests, you will need to login when starting the app for the first time because we need to know who you are.

minimalistic login process

minimalistic login process

As I wrote before, it is not particularly convenient to type words with the Apple TV Remote, we therefore needed another approach to allow users to be authenticated with our system more easily. The process we chose is as simple as you would expect it to be when using an app on the Apple TV. A code generated by our backend is presented to the user on the screen. This code can be entered on the LOVOO website if the user is logged in or scanned by the LOVOO app for Android or iOS. By doing so, the server can authenticate the person who wants to play Match and complete the login process on the LOVOO Apple TV app. If the user has completed the login process, the credentials are securely stored on the device so that another login can be done much faster by just selecting the user’s picture. With that functionality it is very easy to switch between different users, which is necessary since an Apple TV may used by multiple users alternately. That’s basically it for the login module.

Play match on the TV screen

The Match game module itself is much more complex. It uses a brand new network module written from scratch in Swift, building on top of the awesome framework Alamofire. The Match game module has defined three endpoints for talking to the LOVOO backend.

match

LOVOO match on Apple TV

One is for loading appropriate users to be displayed in Match, another one loads information about the logged in user that is necessary for showing a nice overlay when the user gets a match, among other things. The last one transfers information about the votes the user places while playing so that LOVOO can evaluate possible matches.

Swift challenges

Each of these endpoints needs authentication when communicating with the LOVOO backend. This was a challenge we experienced while developing the Apple TV app because we did not want to use legacy code for this brand new app. While doing so, we noticed that Swift is a really great language for designing an app but it can be really hard to use if you want to build standard solutions like building the hash of a given string. The frameworks containing these features are mostly written in C or Objective-C, so you need to import them into the current Swift namespace. Also, Swift is designed in such a way that making the compiler happy can cause a mess. But after all, the compiler is your best friend since he prevents you from doing things that could cause damage.

Technical background of LOVOO Match

When the users to be displayed are loaded, the tvOS app creates Match views for every user. Only two of them are shown at any one time so the controller manages the different states and removes views that are showing users already voted for while adding new views for the upcoming users. The view at the very front shows the current user to be voted. This can be done in many different ways, but the most comfortable way is to swipe the finger across the Apple TV Remote while the underlying view is following the movement of the finger. As the users are used to it, a swipe to the right equals a “like” vote for the user and therefore involves the possibility of creating a match, while a swipe to the left votes against the user shown.
To swipe, the user uses the remote that is dispatched with the Apple TV. Interestingly, Apple is offering the same interface that is used on the iPhone.

matched

Having a match always motivates!

When there is a new match, the user is not sure whether the interest is mutual so it is rather important to inform him or her. Since we did not want to include the chat feature due to the aforementioned reasons, contact is made through the LOVOO app for iOS and Android. When there is a match, we show an overlay that indicates that something good has happened.
If the user has finished playing Match or one of his friends wants to keep searching for his soulmate, a tap on the menu button shows the overview of the saved logged in user so that another one can continue playing Match. It could not be simpler.

Lessons learnt and motivation

From the technical perspective, all server responses are mapped with a special mapping framework called ObjectMapper. With this framework, it is possible to create high-level objects out of low-level data, which is returned by the server. This also motivated us to refactor our iOS app to be much more modular so that parts of it can be used for other prototypes.
Building LOVOO Match for Apple TV entirely in Swift also encouraged us to write every new component entirely in Swift due to the fact that it’s much faster, cleaner and safer. Now that Swift is open source it could also be used to write simple scripts for Linux or maybe a whole server infrastructure could be written with it. We currently have no plans to use Swift in production besides the iOS app but the experience with Apple TV shows us that it’s worth trying new things.
We think that Apple TV is the future of television and LOVOO for Apple TV is a new collaborative and comfortable way of finding new people.

Thanks for your interest and a happy new year!