How to get if the file with same name already exists on document directory iOS swift?

Solution:

The below code used for check if the file with the same name already exists in the document directory.And it will remove the existing file.

code:

if fileManager.fileExists(atPath: mergeAudioFiles.path!) {
            do{
                try fileManager.removeItem(atPath: path!)
            } catch {
                //Do nothing
            }
        }

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift