Ambigious reference to member ‘fileManager'(_shouldProceedAfterError)

I can’t seem to figure out how to solve this error.

I’m getting it from this line:

 

let allImageDirectories = try! fileManager.contentsOfDirectory(atPath: documentDirectory)

 

 

 

Full Function:

 

    func createArrayData()->[FolderCell]{
                    var folderCells: [FolderCell] = []
                    let documentDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.path
                    let allImageDirectories =  try! fileManager.contentsOfDirectory(atPath: documentDirectory)
                    let imageDirectories = allImageDirectories[1...(allImageDirectories.count-1)]
                    
                    for directory in imageDirectories{
                        
                        
                    let imageDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent(directory, isDirectory: true)
                    let allImages =  try! fileManager.contentsOfDirectory(atPath: imageDirectory.path)
                    let displayImage =  UIImage( named: allImages[0])
                        
                        folderCells.append(FolderCell(image: displayImage!, label :directory))
                    return folderCells
                    }

Powered by WPeMatico

About

You may also like...

Comments are closed.