Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

get files with file type swift

let enumerator = FileManager.default.enumerator(atPath: folderPath)
let filePaths = enumerator?.allObjects as! [String]
let txtFilePaths = filePaths.filter{$0.contains(".txt")}
for txtFilePath in txtFilePaths{
    //Here you get each text file path present in folder
    //Perform any operation you want by using its path
}
Comment

get files with file type swift

let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
let url = URL(fileURLWithPath: documentsPath)

let fileManager = FileManager.default
let enumerator: FileManager.DirectoryEnumerator = fileManager.enumerator(atPath: url.path)!
while let element = enumerator.nextObject() as? String, element.hasSuffix(".txt") {
    // do something

}
Comment

PREVIOUS NEXT
Code Example
Swift :: Swift break statement with for loop 
Swift :: swift float 
Swift :: library not found for -lalan-sdk-react-native 
Swift :: secure password field in textfield swift 
Swift :: image preprocessing in python 
Swift :: swift 5 uidatepicker set only date 
Swift :: where to save audio asset swift 
Swift :: password reset with phone number in firebase flutter 
Swift :: string to decimal swift 
Swift :: uialertcontroller example objective Code Answer 
Ruby :: how to get tables list in rails 
Ruby :: ruby uuid 
Ruby :: embedded ruby tag 
Ruby :: config.factory method syntax rails 
Ruby :: fibonacci sums ruby 
Ruby :: ruby min 2 numbers 
Ruby :: ruby generate random number 
Ruby :: ruby integer to timestamp 
Ruby :: how to get new line to display in rails 
Ruby :: ruby how to loop through an array 
Ruby :: ruby pop array 
Ruby :: form feild rails helper 
Ruby :: rails filter hashes by key value 
Ruby :: rails store array in database 
Ruby :: rails change resource name 
Ruby :: ruby get instance variables without accessor 
Ruby :: ruby hash print 
Ruby :: rails link_to example 
Ruby :: ruby merge arrays unique 
Ruby :: minimum of 3 elements 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =