Skip to content

SwiftUI: SKOverlay

In the recent WWDC 2020, Apple introduced SKOverlay where you could recommend other apps to users and allow them to download the app immediately.

Do note that you will not be able to use this on an App Extension.

With the introduction of SKOverlay, it is super useful to advertise your other apps to your users.

A class that displays an overlay you can use to recommend another app.

Apple Documentation

Prerequisites

To follow along this tutorial, you’ll need some basic knowledge in:

  • A basic familiarity with Swift.
  • At least Xcode 12+
  • Only supports iOS 14+

Getting Started With SKOverlay

To begin, you will need to import the required framework.

Then create a State to hold a bool value.

Next, insert a Button which when clicked will show SKOverlay.

In order to test this, you will need to run it on your real device and not simulator. Make sure your real device is at least iOS 14+.

Let’s understand how to retrieve the appIdentifier. You can retrieve that by typing your app name ending with iOS on Google. For example, I will search for one of my app on google Malaysia Law 101 iOS.

So this is how the link will look like. It doesn’t matter if your app is in the market of US or MY, the id still is identical.

Next, you only extract the number which in this case is 1504421248 and add into the parameter as shown in the code above.

https://apps.apple.com/my/app/malaysia-law-101/id1504421248

As of now, the position that is available is only .bottom and .bottomRaised. Let’s see what are the differences.

For .bottom:

For .bottomRaised:

Where to go From Here

If you feel like you are ready to take on more challenges, feel free to check out some other tutorials that we have created:

Published inSwiftUI

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *