Я пробовал это
Код: Выделить всё
struct RepeatOrderIntent: AppIntent {
static var title: LocalizedStringResource = "Seasia Intent"
init(){}
func perform() async throws -> some IntentResult {
OrderManger.shared.openInstagram()
//WidgetCenter.shared.reloadAllTimelines()
return .result()
}
}
Код: Выделить всё
func openInstagram() {
if let url = URL(string: "https://www.instagram.com/") {
openURL(url)
}
}
Код: Выделить всё
struct OpenURLIntent {
var url: String
@Environment(\.openURL) private var openURL
func execute() {
guard let url = URL(string: self.url) else { return }
WidgetCenter.shared.reloadAllTimelines()
openURL(url)
}
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... -of-widget
Мобильная версия