Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save PetreVane/9269da1359ec1e255eea4b02b91cbae9 to your computer and use it in GitHub Desktop.
Save PetreVane/9269da1359ec1e255eea4b02b91cbae9 to your computer and use it in GitHub Desktop.
Iterates over project resources, by getting a Bundle.main refeference
class Testing: UIViewController {
let fileManager = FileManager.default
override func viewDidLoad() {
super.viewDidLoad()
if let path = Bundle.main.resourcePath {
guard let items = try? fileManager.contentsOfDirectory(atPath: path) else { print("Path is not available"); return }
for item in items {
print("This item is: \(item.description)")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment