WidgetKit UIKit

Hello,
is it possible to build the Widgets extensions in UIKit? or is it reserved to be used only with SwiftUI?
Answered by in 614041022
WidgetKit is SwiftUI only. Since the view gets archived it uses one of the many advantages the declarative API gives.
Accepted Answer
WidgetKit is SwiftUI only. Since the view gets archived it uses one of the many advantages the declarative API gives.
Follow up question - can a WidgetKit widget be added to an app that is based on UIKit and has to support iOS 13 and earlier?

Thanks in advance.
Thanks for answer Apple engineer! :)
@brindy666 I believe that it will require you to support iOS 14 as a target deployment.
You can definitely add WidgetKit widgets to an app that supports iOS 13; the system just won't call the WidgetKit extension on older versions of the OS.
You may add a WidgetKit extension to an app that targets older OSes. Your WidgetKit extension will not do anything on these OSes and will be stripped out when downloaded to those devices.

You may also use WidgetKit with an app that uses UIKit (or even AppKit, macOS Catalyst, or even Carbon) because the WidgetKit extension is in a separate process from your app. To be clear, however, inside that WidgetKit extension you may only use SwiftUI. (And CoreGraphics if you want to draw into an image context and use SwiftUI's Image)
WidgetKit UIKit
 
 
Q