FileManger vs Bundle

Why bundle.main does not work when i use it in xcode project ( command line project) but it works when i use it with SwiftUI project. And vice versa with FileManger

Applications (such as SwiftUI projects) are bundles. Tools (Command Line projects) are just a single binary file, so have no main bundle.

https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1

Diggory answered the first part of your question but I’m curious about this:

And vice versa with FileManger

It seems like you’re saying that FileManager doesn’t work in a SwiftUI project, which is most unexpected. Can you clarify this?

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

Terms of Service

Privacy Policy

Cookie Policy