How to use the dynamic island(Live Activity) api in an existing app that still supports old iOS versions?

367 views Asked by At

I created a Widget & a LiveActivity extension in my app. My app still supports iOS 10 and it's a pure objective-c project.

So how I can use the LiveActivity API in my app.

I tried to import LiveActiveWidget.swift in my objective-c project. When I create a swift file in my project and import the Widget file to it, it says:

Compiling for iOS 10.0, but module 'xx' has a minimum deployment target of iOS 16.1

Then I import the "Widget-Swift.h" to an existing objective-c file, it says no such file, may be they are at a different target.

1

There are 1 answers

2
NIRAV BHAVSAR On

you can integrate it by using swift bridging header,

let me explain ,

once you add live activity widget in project , you will able to see one swiftUI file for live activity's UI , now you need to create one swift file for 'ActivityAttributes' in swift , as well need to create one swift file where you will implement all needed methods and code for live activity , now crate bridging header to use your swift code in objective c project , import swift file in a obj-c view controller where you want to implement live activity and call needed functions according your feature flaw, I've implement same way in my project and it's working well .