Analoguhr-WidgetKit. Halten Sie es auf dem neuesten Stand

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Analoguhr-WidgetKit. Halten Sie es auf dem neuesten Stand

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..

Top