8 Must-do How-to Steps to Run the Speech Blubs App on Mac Catalyst
At the beginning of June 2019, iOS and macOS engineers were shaking because Apple was about to release changes at their annual WWDC conference. Whatever they were going to be, they usually change a lot of engineers’ plans for the summer. Our goal is to bring great and quality experiences to iOS/Mac platforms, which usually means working hard to make Apple’s release date of the newest OS. Year 2019 was no different, though maybe even a bit more special.
As usual, Apple released a lot of new features, but there was one that I was personally looking forward to testing. It’s been common knowledge for over a year that they have been working on a UIKit port to macOS. There are several apps in macOS Mojave built on this technology, which Apple themselves have built.
What Does it Mean for App Developers Exactly
It means that we would be able to run code for our iPhone and iPad apps with very few changes natively on macOS. It also means we would not have to rewrite our user interface code from UIKit to AppKit, which has been used on macOS for decades. Basically, we could add the whole macOS platform to our portfolio with just a few hours of development.
Since the technology was already in the OS last year, people were already excited and started experimenting with the so-called “Project Marzipan.” In 2019, it became official, and it’s now called ‘Project Catalyst,’ which is included in the official macOS Catalina release. But, how does it work in practice? How long does it take to make a real, production iOS app run on macOS with Catalyst?
Speech Blubs on the Mac
I really wanted to know the answer to these questions. Speech Blubs is our main app and we are achieving great results on iOS. It’s a complex application in several languages, with more than 100,000 lines of code, multiple 3rd party libraries, and so on. To me, it sounded like a great and realistic choice for this experiment. So I just had to start working on a Mac version . . .
First, I opened the project, created a new branch, and clicked the macOS platform! The next step was to just make it compile! Building the app would emit more than 100 errors. Oh dear. But let me continue. First, we had to ensure all third party libraries were building and linking. As the project uses CocoaPods, this would make it a bit more complicated, as Catalyst support can be still a bit buggy. So, I started removing our analytics libraries, including Facebook, Crashlytics, and their dependencies, as we do not really need them for this experiment.
We arrived at the last linking issue: Realm. Speech Blubs uses Realm as a database because it is one of the best mobile databases out there. We were linking it via CocoaPods and it just would not build. The only way to include it was with Swift Package Manager, which we hadn’t used so far.
Swift Package Manager
We use several private frameworks and build the project with CocoaPods. Converting to SPM would not be a small task for sure. But we didn’t really have to drop CocoaPods entirely, as they work hand in hand with Xcode’s SPM integration. So, I started by converting our internal frameworks to be linked with SPM. That also included converting all their dependencies. It took me roughly an hour to learn to write a simple package, a swift file, and convert all our dependencies.
Even to my surprise, I got through much faster than I originally expected. It is still a bit annoying to add Swift Packages manually to Xcode, as you need it to reload every time you make a small change on the GIt repository on GitHub.
Compiling and Running Speech Blubs on Mac
So, now all the dependencies compile and link successfully, but the app still does not. I already removed some third party libraries, including our chat support. To continue, I began to comment out the code that made calls to those libraries and after about an hour of work, the project was building successfully. To finally run it, all I needed to do was to press the ‘Play’ button in Xcode, on ‘My Mac’ as a target device, and Speech Blubs was running on a desktop for the first time! It’s an amazing feeling seeing that familiar iOS icon in your Dock.
Glitches and Bugs
The first run showed that there were some bugs and glitches. MacOS is a completely different platform. Understandably, there were a couple of things in Speech Blubs that we would need to fix. We had some issues with the buttons, as they appeared too big. Most likely just auto-layout constraints that needed to be fixed. Scrolling on worked, but seemed a bit unresponsive at times. Our camera and microphone features did not work correctly, as there were vast architectural differences. Our third party analytics and support were also missing for it to be a fully-featured product.
Aftermath
Aside from a few glitches and bugs, Catalyst actually does the heavy lifting for you. Gesture recognizers worked nicely, all default UIKit elements work pretty well, too. Most of our model code already ran out of the box, as it was UI-independent. In cases like these, solid architecture really helps with moving things quickly to a new platform. Does it make sense for the product itself? I honestly don’t know. Most of the mechanics that we use in the app aren’t a good fit on the Mac, but that does not mean we did not pursue the idea. Every app is different and has its own unique features. And each platform is different, the same goes for watchOS, tvOS, and so on. Overall Catalyst is a great toolset, and if your app makes sense on Mac as well, it can really simplify and speed up the development process if you are supporting both iOS and macOS platforms. And even more so when you will be able to use SwiftUI, which is at least one year away. Either way, it was a good experiment to do, just to see how it would all turs out. You may experience bugs that are there due to workarounds you implemented on iOS, but they no longer work on the Mac. So to answer my question, how long does it take? It depends. On the product itself, on iPad support, code quality, and how native you want the app to feel on the Mac.
Get in Touch with Speech Blubs’ Developers Team!
If you want to chat about app development, feel free to contact us. It is what we do and what we love, so we really like to talk about it! :)