Are you looking how to store logs on the device file system? Here I will show you how you can achieve it.
In an App I was developing lately who is an enterprise iOS app with limited connectivity. The requirement was to have logging but not on the network.
My choice was settled on CocoaLumberjack, because it looks mature, and with good features.
If you are using pods, add this to your pod file
pod 'CocoaLumberjack/Swift'
Then run pod install
The setup is simple just add this code to your app.
//add this on your App Delegate import area
import CocoaLumberjack
// Then inside you didFiniLaunching
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
....
let fileLogger: DDFileLogger = DDFileLogger() // File Logger
fileLogger.rollingFrequency = 60 * 60 * 24 // 24 hours
fileLogger.logFileManager.maximumNumberOfLogFiles = 5
DDLog.add(fileLogger)
...
Is simple as it looks. you can also see on which directory logs are stored with the following.
print("logsDirectory" , fileLogger.logFileManager.logsDirectory)
Now you can enjoy your logs file.
You can find CocoaLumberjack on GitHub https://github.com/CocoaLumberjack/CocoaLumberjack