by Guest » 12 Jan 2025, 09:43
Ich erstelle eine App, die ein Uhr-Widget enthält. Ich möchte, dass das Widget möglichst jede Sekunde aktualisiert wird. Ich hatte etwas Glück beim Erstellen einer langen Zeitleiste – aber ich stoße immer noch auf die von Apple auferlegte Drosselungsbeschränkung.
Ich habe mit einer festen Animation für die „Fälschung“ aus zweiter Hand experimentiert. die Sekunden. Aber das Widget bleibt ständig „hängen“, das ist mein Problem.
Gibt es irgendwelche Tipps oder Tricks, damit mein Widget jede Sekunde läuft und „aktualisiert“ bleibt?
Ich habe mehrere Apps im App Store gesehen, die dies tun. Es muss also möglich sein.
Code: Select all
struct Provider: AppIntentTimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), configuration: ConfigurationAppIntent())
}
func snapshot(for configuration: ConfigurationAppIntent, in context: Context) async -> SimpleEntry {
SimpleEntry(date: Date(), configuration: configuration)
}
func timeline(for configuration: ConfigurationAppIntent, in context: Context) async -> Timeline {
let currentDate = Date()
var entries: [SimpleEntry] = []
// Create entries for the next 30 minutes, one every second
let numberOfEntries = 30 * 60 // 30 minutes * 60 seconds
for offset in 0..
Ich erstelle eine App, die ein Uhr-Widget enthält. Ich möchte, dass das Widget möglichst jede Sekunde aktualisiert wird. Ich hatte etwas Glück beim Erstellen einer langen Zeitleiste – aber ich stoße immer noch auf die von Apple auferlegte Drosselungsbeschränkung.
Ich habe mit einer festen Animation für die „Fälschung“ aus zweiter Hand experimentiert. die Sekunden. Aber das Widget bleibt ständig „hängen“, das ist mein Problem.
Gibt es irgendwelche Tipps oder Tricks, damit mein Widget jede Sekunde läuft und „aktualisiert“ bleibt?
Ich habe mehrere Apps im App Store gesehen, die dies tun. Es muss also möglich sein.
[code]struct Provider: AppIntentTimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), configuration: ConfigurationAppIntent())
}
func snapshot(for configuration: ConfigurationAppIntent, in context: Context) async -> SimpleEntry {
SimpleEntry(date: Date(), configuration: configuration)
}
func timeline(for configuration: ConfigurationAppIntent, in context: Context) async -> Timeline {
let currentDate = Date()
var entries: [SimpleEntry] = []
// Create entries for the next 30 minutes, one every second
let numberOfEntries = 30 * 60 // 30 minutes * 60 seconds
for offset in 0..