Chapter 22: Converting an iOS App to macOS

In struct SearchFlights
Since .searchable() needs NavigationView, simply modified the text field to work as a searchField:

@State private var showListOfCities = false
@FocusState private var focusedField

TextField("Search cities", text: $city)
          .clipShape(RoundedRectangle(cornerRadius: 5))
          .onSubmit(of: .text) {
            Task {
              runningSearch = true
              showListOfCities = false
              await flightData = FlightData.searchFlightsForCity(city)
              runningSearch = false
          .onChange(of: city) { newText in
            showListOfCities = true
          .onChange(of: focusedField) { clicked in
            showListOfCities = clicked ? true : false
          .popover(isPresented: $showListOfCities, arrowEdge: .bottom) {
            VStack(alignment: .leading, spacing: 2) {
              ForEach(FlightData.citiesContaining(city), id: \.self) { city in
            .frame(minWidth: 150)

Steps to Convert an iOS App to macOS

With Apple’s new Mac Catalyst program everyone who owns an iOS app is looking to convert their app to a MacOS application. Our company also wanted to look into the possibility of converting our iOS app and reach more users through MacOS.

Facing lots of obstacles(Mainly not having proper documentation) we’ve now reached the phase where our app is distributable through Mac App Store or directly to Customers.

The Basics
Before anything we need MacOS Catalina(10.15) and Xcode 11 to build a Catalyst app.

For an overview of the basics you can refer to Apple’s documentation. This describes the changes you need to make in the Project file in order to build the Catalyst app.

Creating a Mac Version of Your iPad App
Starting with Xcode 11, you can create a Mac version of your iPad app using Mac Catalyst. Configuring your app to run

Diving Deep
Window Resizing
One main issue we faced was in MacOS users are able to change the window size to any desirable size. With an iOS app developed for iPad screen sizes and aspect ratio the UIs of our app messed up pretty bad.

3rd Party Frameworks
Then comes the huge issue we are still facing which is 3rd party libraries. Our iOS app uses lot of 3rd party libraries which are mainly for payment gateways. Because the Mac architecture and iPad architecture is different the libraries which are in iOS app will not support the Mac architecture and the project will not build. We are currently in the process of building the 3rd party frameworks for the MacOS X86 architecture and contacting the developers for the updated frameworks. (Currently we are running our app by removing the unsupported libraries)

But if you use CocoaPods for the frameworks I think you should be fine when building the project.

Then we had to do some UI changes here and there in the Storyboards and our app was good to go.

Then Comes the Distribution
If you’ve only worked with iOS apps as me you might not have a clear understanding on how the Mac application distribution works. There are 2 methods you can use to distribute your catalyst application.

Through the Mac App Store
If you already have access to Appstore Connect you can create a new MacOS application there and simply archive and upload your app. Xcode will manage all the certificates generation and signing process automatically.

Distribute directly to Users
MacOS contains an utility called Gatekeeper which blocks external(3rd party) applications running in your Mac.

If you just copy the generated .app file and run it in another Mac the app won’t start because of this. It will crash and give an error stating ‘namespace codesigning code 0x1’ .

To fix this we need to sign our app using a certificate called ‘Developer ID’. This certificate can only be generated by the account holder of your Apple Developer account. Your account holder has to create this certificate and export it with the private key. Once the certificate is installed in your Mac you can go ahead and sign the application.

When you select Developer ID you will be given the option to upload the app to Apple’s notary service and add another layer of certification so the users can place 100% trust in your application. This process only takes 15–30 minutes and Voila!.. You can now send your app to all your users without any issue.

Rachel Gomez