In Xcode 12 Beta 3, I am getting a warning that StaticConfiguration.init(kind:provider:placeholder:content:) is deprecated and that StaticConfiguration.init(kind:provider:content:) should be used instead.
My question is how does one specify a placeholder view now?
Thanks,
Rob
My question is how does one specify a placeholder view now?
Thanks,
Rob
You should implement placeholder(with: Context) to return a TimelineEntry that contains whatever you need for your placeholder. Note that unlike snapshot and timeline which are asynchronous with a completion block, the placeholder method is synchronous and you return a timeline entry immediately. So you want to be fast to return that entry.
When your widget's view is rendered for placeholder purposes it's given the placeholder entry and you can render your view accordingly. Note, there's some new SwiftUI support for marking a view as redacted. What should happen is that when WidgetKit renders the widget's view using the placeholder timeline entry, it would automatically render the view using .redacted(reason: .placeholder). Unfortunately that isn't working in Beta 3, but should be fixed in an upcoming seed.
Let us know if that doesn't make sense. If you have trouble getting it working please file Feedback Assistant report with details, and post the number here.
When your widget's view is rendered for placeholder purposes it's given the placeholder entry and you can render your view accordingly. Note, there's some new SwiftUI support for marking a view as redacted. What should happen is that when WidgetKit renders the widget's view using the placeholder timeline entry, it would automatically render the view using .redacted(reason: .placeholder). Unfortunately that isn't working in Beta 3, but should be fixed in an upcoming seed.
Let us know if that doesn't make sense. If you have trouble getting it working please file Feedback Assistant report with details, and post the number here.