Failed Experiment: Cross-Platform Target

Apple released the newest version of Xcode, Xcode 8, last week. A new feature in Xcode 8 is the addition of a cross-platform project template for SpriteKit games that lets you create iOS, Mac, tvOS, and watchOS versions of the game in one project. Because I’m developing iOS and Mac versions of LetterMiner, I decided to see if I could convert it to the cross-platform project. I figured the cross-platform project would make it easier for me to support both iOS and Mac.

My Initial Project Setup

I have separate git branches for the iOS and Mac versions of the project. The iOS branch creates a universal iOS application that runs on iPhones, iPads, and iPod Touches. The Mac branch creates a Mac application.

I’m able to share 90-95% of LetterMiner’s code. There are two areas where I need separate code for iOS and Mac. The first area is launching the game. The second area is handling player input because iOS uses touch input and Mac uses mouse input.

The most difficult part in my current setup is merging code I develop on the Mac version to the iOS version when I add new source code files to the project. The newly created files don’t appear in the project after the merge, forcing me to manually add them to the project. The first time I merged it was very painful, but once I figured out what I needed to do, the merges became more manageable. I was hoping the new cross-platform project could eliminate the merges.

Starting the Experiment

I began by creating a new git branch for my experiment so it wouldn’t interfere with my working version of the game. I branched off the Mac version. After creating the branch I created a new cross-platform target for the game and removed the old Mac target.

I tried to build the target and got tons of compiler errors. I had to go through the source code files and make them members of the new cross-platform target so they would be compiled when I built the project. Once I did that I was able to build the Mac version of LetterMiner.

Moving to the iOS Version

After building the Mac version I moved on to the iOS version. I added code to support touch input and copied my iOS game launching code to the app delegate and view controller class files Apple created for the iOS version of the cross-platform target.

I built the project and realized I had a problem. The iOS and Mac versions of LetterMiner do not behave the same. The iOS version has a scrolling camera to scroll the game board so people can play on an iPhone. The Mac version has no need for a scrolling camera because the screen is big enough to show the entire game board.

Another problem I discovered was the game scenes for the iOS and Mac versions have different needs. The iOS version needs to have the labels and buttons positioned close enough so everything can fit on an iPhone screen. But that layout looks terrible on the Mac version. Spacing the labels and buttons to look good on larger screens cuts off parts of the game’s user interface on smaller screens. The cross-platform target wasn’t going to work for me.


Apple’s cross-platform SpriteKit game project is a good idea. If I was making a new game from scratch, I would start with that template. But I’m too far along in LetterMiner’s development and have too many differences in the iOS and Mac versions to take advantage of the cross-platform game template.