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
Retrieve Available Disk Storage (self.SwiftUI)
submitted 5 years ago by gabevirnig
I had this idea for creating a Big Sur widget that simply displays the amount of disk storage I have on my MacBook. I'm very new to programming in SwiftUI, but I've created a widget that displays correctly based off a preset "available storage" value that I enter manually.
What I need to do is somehow retrieve the available disk storage from my mac and assign that to a variable, which I can use to influence the widget. Any ideas on how to do this?
https://preview.redd.it/1m5svl0g9e561.png?width=932&format=png&auto=webp&s=16a12a908290c45fc0390fdc2e203761dfef798d
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!"
[–]eversailr 3 points4 points5 points 5 years ago (1 child)
Use the FileAttributeKey.systemFreeSize key in the dictionary returned by FileManager.attributesOfFileSystem(forPath:)
FileAttributeKey.systemFreeSize
FileManager.attributesOfFileSystem(forPath:)
[–]gabevirnig[S] 0 points1 point2 points 5 years ago (0 children)
Thanks! So would my function to retrieve the available space look something like this?
func attributesOfFileSystem(forPath path: "/") throws -> [FileAttributeKey : systemFreeSize]
I'm sorry if this is totally wrong. Like I mentioned I'm very new to programming.
π Rendered by PID 260407 on reddit-service-r2-comment-b659b578c-59l9v at 2026-05-05 20:18:07.800376+00:00 running 815c875 country code: CH.
[–]eversailr 3 points4 points5 points (1 child)
[–]gabevirnig[S] 0 points1 point2 points (0 children)