WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

Day 68 mini challenge

Forums > 100 Days of SwiftUI

I had a very similar solution to Paul for adding an extension to FileManager to the the documents directory. But I used self instead of FileManager inside the computed variable:

extension FileManager {
    static var documentsDirectory: URL {
        let paths = self.default.urls(for: .documentDirectory, in: .userDomainMask)
        return paths[0]
    }
}

Is there a difference? Does it matter?

   

Hacking with Swift is sponsored by RevenueCat

SPONSORED You know StoreKit, but you don’t want to do StoreKit. RevenueCat makes it easy to deploy, manage, and analyze in-app subscriptions on iOS and Android so you can focus on building your app.

Explore the docs

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.