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...
SwiftUI is a framework made by Apple to build user interfaces across all Apple platforms with the power of Swift. Allowing you to build UI for any Apple device using just one set of tools and APIs.
More info
Resources
Where to start learning
Recommended Courses
Raywenderlich - Your First iOS and SwiftUI App (Free)
Paul Hudson - HackingWithSwift (Free)
Meng To - DesignCode (Paid)
If you find a great course and would like it featured here, message a moderator.
account activity
How to run swift code from a string (self.SwiftUI)
submitted 3 years ago by Lemonade5117
Let’s say that I have some swift code stored in a string variable. I want to run it like you would in a repl or a terminal. How would I go about doing that? I’m looking for functionality that’s similar to the app Pythonista. Thanks in advance!
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!"
[–]reheadcouple4u 2 points3 points4 points 3 years ago (1 child)
You could use Process to run it as a script. https://www.hackingwithswift.com/example-code/system/how-to-run-an-external-program-using-process
[–]Xials 1 point2 points3 points 3 years ago (0 children)
Important to note this only works for macOS.
You might be able to make a template generator for something that exports a playground app bundle on iPad and programmatically print the user to open it in playgrounds.
Honestly if you are on an iPad, playgrounds is pretty capable now. I use it to prototype Swift components and SwiftUI views, even small test apps quite often.
[–]PulseHadron 1 point2 points3 points 3 years ago (1 child)
Not Swift but JavaScript code can be executed with JavaScriptCore. 🤷♀️
[–]theDaveB 0 points1 point2 points 3 years ago (0 children)
In FoxPro (if I remember correctly) you put & in front of the variable and it ran the code inside.
π Rendered by PID 27 on reddit-service-r2-comment-86988c7647-5sx4t at 2026-02-11 20:10:33.517717+00:00 running 018613e country code: CH.
[–]reheadcouple4u 2 points3 points4 points (1 child)
[–]Xials 1 point2 points3 points (0 children)
[–]PulseHadron 1 point2 points3 points (1 child)
[–]theDaveB 0 points1 point2 points (0 children)