Support widgets for iOS 12 and above

229 Views Asked by At

I need to support widget for iOS 12 and above for my app. I've created a Today extension widget which works fine. But now for iOS 14 I want to show the new widget. I know how to create widget in iOS 14 but need to know how can I switch between these widgets so as to support backward compatibility till iOS 12 and also use new widget for iOS 14 and above.

Basically I need something like this. But not sure how to do that.

if #available(iOS 14.0, *) {
    // use the new widget created with widget extension
} else {
    // use the old widget created with today extension
}

Any help is appreciated.

0

There are 0 best solutions below