【问题标题】:Determine the order of the widgets in the widget gallery without WidgetBundle (Swift)在没有 WidgetBundle (Swift) 的情况下确定小部件库中小部件的顺序
【发布时间】:2022-12-02 20:59:01
【问题描述】:

Situation

My app provides multiple widgets and only some of the widgets use location, thus I separated the widgets into multiple extensions. This allows the system to only prompt the user for the widgets that use location information. I can\'t use the WidgetBundle approach anymore, to determine the order of the widgets in the widget gallery.

Problem

Is there another way to determine the order of the widgets in the widget gallery with two extensions?

What I have tried:

I created a Swift-file which has a target membership to both app extensions. I used the WidgetBundle approach described here: Can I determine the order of the widgets in the gallery (Swift)?. I declared the class as the only @main for both extensions and expected it to show the order as listed in the class. Xcode threw and error, that my widgets were out of scope despite the target membership being correct.

I tried to reorder the targets in my project, and expected that the widgets\' order will be displayed accordingly.

  • Does renaming targets alphabetically help?
  • If you mean by renaming them to sort them alphabetically then no unfortunately that didn\'t work.
  • Better raise a ticket with TSI (DTS team) and ask them. It takes about 2 weeks for them to respond and will be off during Christmas, so ask it before that

标签: swift widgetkit


【解决方案1】:
猜你喜欢
  • 2021-01-14
  • 2013-08-28
  • 1970-01-01
  • 2013-06-23
  • 2020-05-09
  • 1970-01-01
  • 1970-01-01
  • 2018-02-01
  • 1970-01-01
相关资源
最近更新 更多