锁屏Swift小部件仅适用于iOS 16用户
我有多个针对iOS 14用户及以上的小部件。但是有了新的锁屏窗口小部件,它仅适用于iOS 16用户。我只能为iOS 16用户制作底部的两个小部件?如果我删除顶级线,那么我相信它将使所有小部件仅适用于iOS 16用户,但我不能这样做,我希望我的用户能够继续使用主屏幕窗口小部件,如果他们在iOS 14--上15。
import WidgetKit
import SwiftUI
//@available(iOSApplicationExtension 16.0, *)
@main
struct Widgets: WidgetBundle {
@WidgetBundleBuilder
var body: some Widget {
Widget1()
Widget2()
Widget3()
LockscreenWidget1()
LockscreenWidget2()
}
}
I have multiple widgets that are for iOS 14 users and above. But with the new lockscreen widgets, it's only available to iOS 16 users. How can I only make the bottom two widgets for iOS 16 users? If I uncomment the top line then I believe it will make all widgets only available to iOS 16 users but I can't do that, I want my users to be able to continue using the home screen widgets if they're on iOS 14-15.
import WidgetKit
import SwiftUI
//@available(iOSApplicationExtension 16.0, *)
@main
struct Widgets: WidgetBundle {
@WidgetBundleBuilder
var body: some Widget {
Widget1()
Widget2()
Widget3()
LockscreenWidget1()
LockscreenWidget2()
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在小部件逻辑中配置它。
例如
You need to configure it inside your Widget logics.
e.g.