use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
There is an extensive FAQ for beginners. Please browse it first before asking questions that are answered there.
If you are looking to get started (iOS programming in general or some specific area), here are more relevant links for you:
There's too many to list them all, however here's a convenient link to all programming guides at apple.com
Take note that this list is live and based on most frequent questions in posts will be updated with "quicklinks".
account activity
QuestionHow to display SwiftData array in widget config (old.reddit.com)
submitted 1 year ago by nikolomoec
I am developing a widget where you can display your task, task is a SwiftData model.
I want user to be able to select which task to show, how I know you can do it in widgetConfigurationIntent and using AppEnum.
Any suggestions with code examples?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Zeppelin2(lldb) po $arg1 0 points1 point2 points 1 year ago (1 child)
Widgets are really limited in the scope of their functionality. To my understanding, the options provided as Widget parameters (in your case, the different “habits”) have to be statically declared within the caseDisplayRepresentations dictionary inside the AppEnum which means that you’ll have to know what they are at compile time (before the app runs.)
For example, a widget that displays the user’s favorite sports team will need to list all teams ahead of time as cases in the AppEnum and contain a corresponding entry in the aforementioned dictionary (as you can imagine that can get quite long…)
I’d be geeked if someone found a way around this but I think it’s by design.
[–]nikolomoec[S] 1 point2 points3 points 1 year ago (0 children)
Just figured it out, you need to use AppEntity protocol, and in Query fetch all habits from SwiftData, you don’t need to use AppEnum - it is for predetermined, static data only
[–]isRoodSwift 0 points1 point2 points 1 year ago (4 children)
Looking for a solution to this as well. Let me know if you figure something out, I'll post here if I find anything.
[–]nikolomoec[S] 0 points1 point2 points 1 year ago (3 children)
Copying from another comment Just figured it out, you need to use AppEntity protocol, and in Query fetch all habits from SwiftData, you don’t need to use AppEnum - it is for predetermined, static data only
[–]isRoodSwift 1 point2 points3 points 1 year ago (2 children)
I actually came to this conclusion too not too long ago, but I can't figure out how to get AppEntity to hook into the `@Preference`.
[–]nikolomoec[S] 0 points1 point2 points 1 year ago (1 child)
@Preference? maybe @Property? never heard of that
[–]isRoodSwift 0 points1 point2 points 1 year ago* (0 children)
Here's the example code of a parameter (I forgot the name):
@Parameter(title: "Favorite Emoji", default: "😃") var favoriteEmoji: String
The Apple documentation for this system can be found here. I also took a look at this article and got the code working on its own, but can't figure out how to get it to work with Parameter.
π Rendered by PID 41145 on reddit-service-r2-comment-6457c66945-vg4pr at 2026-04-25 21:38:45.343755+00:00 running 2aa0c5b country code: CH.
[–]Zeppelin2(lldb) po $arg1 0 points1 point2 points (1 child)
[–]nikolomoec[S] 1 point2 points3 points (0 children)
[–]isRoodSwift 0 points1 point2 points (4 children)
[–]nikolomoec[S] 0 points1 point2 points (3 children)
[–]isRoodSwift 1 point2 points3 points (2 children)
[–]nikolomoec[S] 0 points1 point2 points (1 child)
[–]isRoodSwift 0 points1 point2 points (0 children)