Hey guys! I´m a absolute beginner in Swift. And actualy i try some simple thinks in a small app. Here you would see a Table View with files in "iTunes files". With some pathExtension like PDF, PNG, JPG or without a extension you´ll see a folder.
My problem: The screen shows every single file or folder. And it is possible for me to show exactly one image: An Folder image, PDF image or whatever. But it isn´t possible to let the code deside. An example:
cell.imageView?.image = UIImage(named: "folderImage.png")
Here is a Cell mit the name "cell". And he print a UIImage named "folderImage.png". But evey file like a "png", jpg" or whatever becomes the folder image too. The whole day i try things like this:
let fileExtension = (input as NSString).pathExtension
cell.imageView?.image = UIImage(named:
switch fileExtension {
case "pdf":
"pdfImage.png"
case "rtf":
"rtfImage.png"
...
default:
"folderImage.png"
}
)
Please please help me! 😟 What is to do, that these output in "extension ViewController: UITableViewDataSource" choose the image by hisself.
Thank you very much!