RemObjects TV | RemObjects Software
Products Shop Support Company |

UIKit for Mac with Elements (2:39)

Download the Video | View on YouTube

This is a video about Elements.
Watch more Elements Videos. Read more about Elements.

Transcript

In this video I will show you how to easily adjust an iOS application to include UIKit for Mac and run on macOS Catalina.

Let's start by opening an existing iOS project. In this case, I'm using the simple Weather app we created in our previous video — it's a table view that shows temperature data downloaded from the Internet.

Turning this into a Mac app is easy. If you check the "Settings" page for the project, you will see there's a new setting called "UIKit for Mac". Simply changing this option to "YES" does the trick. When we look at the device picker at the top, "Mac" is now a valid option.

We can go ahead and run this app right away, by clicking the Run button, or pressing ⌘R.

Nice.

But let's tweak a few more things.

First, let's add a a proper Mac application icon to the app.

Right-click the "Resources" folder, and select "New File" from the popup menu. Select "Application Icon" from the list of templates, click "OK", then click "Create File". Now the app will have a nicer looking icon in the Dock and in the Finder.

Let's also add a separate .entitlements file so that we can control runtime entitlements for macOS and iOS separately. Right-click on "Resources" again, and this time select "Entitlements File", then click "OK", then "*Create File"". Let's have our app run sandboxed, and specify it will need to access the network.

Go back to the "Settings" pane, and we can set both the new icon file and the .entitlements file to be used for the Mac version, by updating these two settings.

Press ⌘R to run again, and our app comes up with the new icon, and properly sandboxed.

Of course, what we have so far is an iOS app running in the Mac, not a real Mac app. Depending on the app, additional work will be needed to make it feel truly at home. for example, adding a custom Menu resource, setting up keyboard shortcuts and Touch Bar support and more — but we'll leave that for another time...