I'd assume that you can add a Widget to your project even if the project is written in. Obj-C. As long as you use SwiftUI for the actual Widget and can share resources from the RSS Obj-c feed, then you shouldn't have a problem.
Post
Replies
Boosts
Views
Activity
A digital clock would have to be updated every 60 seconds, and that MAY take a hit on battery performance, and, besides, there’s already a clock in the upper-left corner on an iPhone and iPad.
Yes, that worked. THANK YOU!
Here you go:
Widget Code - https://developer.apple.com/forums/content/attachment/e436919f-ffc6-4b7d-9eaf-6afcbdb4bcd1
Sure, in a few mins. Thanks.
Look into incorporating dateformat and date() in your code. Something like:
let formatter = Date()
formatter.dateformat = “mm”
Text(“\(mm) minutes ago”)”
That may not be the exact cod, but it should get you on the right track.
I don't think we're supposed to use List in a Widget, as it would need to be interactive. Widgets aren't supposed to be interactive.
Dan
I’d like to know as well.
Glad to see I’m not the only one.
Do what I did, file a bug report via the feedback app. Maybe if they get enough people, they can find an answer and people like us can keep our hair. :-)
Dan
I think what Apple means by that statement is, Widgets are just supposed to be a quick reference tool, and not supposed to be as interactive as an app. Meaning, no buttons, text fields, or anything else that may require a user to interact with a widget for a long time (other then changing a location as in a weather widget).
Done.
Feedback #: FB7881669
Thanks.
Make sure your app is checking to see if its running on iOS 13 or iOS 14:
Something such as:
@available(iOS 13.0.0, *)
var body: some View {
Thanks for getting back to me!
The error is: “Cannot Preview in this file - Unexpected error occurred” and then the usual [Try Again] and the [Diagnostics] buttons come up.
When choosing the latter, the following error appears:
”Remote Human Readable Error: PreviewAgentError: Statically rendering previews is not supported on iOS Simulators”
Granted, I am using the default Hello Word Placeholder in the PreviewProvider, but when I tried to change this to mirror the WWDC2020 Video Code along, I get the same error.
I am attaching the said code for the project to this message.
If you have any other questions, please let me know.
Dan Uff
Actual Widget Code - https://developer.apple.com/forums/content/attachment/4c8b89b2-c8b8-4cf7-8468-009b8fb4296a
}
@main
struct CPCWidget: Widget {
private let kind: String = "CPCWidget"
public var body: some WidgetConfiguration {
StaticConfiguration(kind: "com.connectingpeoplesoftware.cpclockwidget",
provider: Provider(),
placeholder: PlaceholderView()) { entry in
CPCWidgetEntryView(entry: entry)
}
.configurationDisplayName("CPClock")
.description("CPClock in widget form.")
.supportedFamilies([.systemSmall, .systemMedium, .systemLarge])
}
}
struct CPCWidgetPreviews: PreviewProvider {
static var previews: some View {
/*@STARTMENUTOKEN@*/Text("Hello, World!")/*@ENDMENU_TOKEN@*/
}
}
```
Yes it did. Thanks.
As said in a few WWDC2020 widget videos, Widgets are NOT supposed to be interactive, except when a user needs to input information such as a weather app asking for a zip code. No buttons.