Can I add WidgetKit extensions to an app with target iOS < 14?

邮差的信 提交于 2021-01-02 05:46:16

问题


I want to add a (WidgetKit-)widget to my iOS app. The app itself should keep a target of < 14. Obviously, the widget would be available only on those devices >= 14, but the app should run on all other devices as well. Is this possible?


回答1:


Yes, you can as I develop the Widgets on an iOS13 Xcode project. You can see them on an iPhone that runs iOS14 and not on the iOS13 one. You just need to add @available(iOS14) in your code because you are using WidgetKit. But don't worry, Xcode will remind it to you nicely. This is the WidgetKit framework that is not available under iOS14, iPadOS14 or macOS11.




回答2:


Yes it is possible! WidgetKit is only an extension added to your application that would render on devices which support that particular extension. You can definitely create an app that would run on devices <= or > iOS14, iPadOS14, macOS11 and so on and the widget for the same which would be rendered on devices >= iOS14, iPadOS14, macOS11. WidgetKit is just an added facility to your application just like there are certain features of an application that can run on higher devices but not on old versioned devices.




回答3:


Select iOS 14 for your new target



来源:https://stackoverflow.com/questions/63131113/can-i-add-widgetkit-extensions-to-an-app-with-target-ios-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!