Accessing the Caches Directory

Accessing the caches directory via an Xcode Project.

let cachesDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!

print(cachesDir)

// file:///Users/your-mac-username-here/Library/Caches/

With the path from the printed path above you will now be able to search using the Finder app or (command, space bar) on your mac for the particular cache folder you are interested in.

For example, if you’re interested in accessing the “XCTest” cache folder, the name would be com.apple.dt.xctest.tool.

A possible full path for com.apple.dt.xctest.tool depending on your mac’s configuration and using Finder or (command, space bar) could be: file:///Users/your-mac-username-here/Library/Caches/com.apple.dt.xctest.tool

Being able to isolate the caching system during TDD is a flow I’ve acquired from the iOS Lead Essential Developer program.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s