import AppIntents import WidgetKit // MARK: - Interactive widget intents (iOS 17+) // // These run in-process from the widget via `Button(intent:)` — no app launch. // The intent type compiles on iOS 16, but the interactive Button that invokes it // is gated to iOS 17 in the widget views, so iOS 16 still builds and works with // the existing `.widgetURL` deep links. /// Reloads all widget timelines so the numbers refresh without opening the app. struct RefreshWidgetIntent: AppIntent { static let title: LocalizedStringResource = "Refresh Portfolio Widget" static let description = IntentDescription("Reload the portfolio widget with the latest values.") static let isDiscoverable = false func perform() async throws -> some IntentResult { WidgetCenter.shared.reloadAllTimelines() return .result() } }