Get last created file in IOS

Hi! I’m very stuck trying to have my IOS application open files from my mail client. I’m almost there tho.
I just need to find a way to get the last created document in my users IOS documents folder because that’s where mail client and other applications copy the file towards.

I currently have this function that creates an Array<File> importedFiles; with a list of all the files in that folder. i just need to sort them by creation date and pick the last one.

void getFileFromMail()
    bool searchRecursively = true;
    String wildCardPattern = "*.xml";
    int numberOfFiles = File::getSpecialLocation(File::userDocumentsDirectory).findChildFiles(importedFiles, File::findFiles, searchRecursively, wildCardPattern);                
    fileFromMailClient = importedFiles.getFirst();

currently i’m reading the first file in the array, but i need the last created file. What would be the least convoluted way of doing this?

Sort (or search) your Array using File::getCreationTime