Write a log text file on Disk use TextOutputStream in Swift 4 iOS
You need to create your own log file to record events in your application in your own way. Here is the most typical way to create a text file and save it on the disk of an iOS device like iPhone, iPad, iPod.