Andrew O Hart
11/18/2021, 6:17 PM//get an instance of the File Manager
NSFileManager *fileManager = [NSFileManager defaultManager];
//we'll list file in the temporary directory
NSString * strPath = NSTemporaryDirectory();
//we'll need NSURL for the File Manager
NSURL *tempDirURL = [NSURL fileURLWithPath:strPath];
//An array of NSURL object representing the path to the file
//using the flag NSDirectoryEnumerationSkipsHiddenFiles to skip hidden files
NSArray *directoryList = [fileManager contentsOfDirectoryAtURL:tempDirURL
includingPropertiesForKeys:nil
options:NSDirectoryEnumerationSkipsHiddenFiles error:nil];
How can that be written in Kotlin?
I think I need to do import platform.Foundation.NSFileManager right?
I'm not sure exactly how I can find a .db file though. Or use these classes / methods.
Is there a way to see method names etc in the IDE? Right now it seems to import but its red and I can't see methods etc.
Any tips would be greatDiego Medrano
11/18/2021, 6:34 PMkotlin.mpp.enableGranularSourceSetsMetadata=true
to your gradle.properties
that will resolve the red importsAndrew O Hart
11/18/2021, 6:36 PMDiego Medrano
11/18/2021, 6:42 PMAndrew O Hart
11/18/2021, 6:55 PMco.touchlab.sqliter.DatabaseConfiguration
and
import com.squareup.sqldelight.drivers.native.NativeSqliteDriver
Is this something to do with libraries?Diego Medrano
11/18/2021, 7:04 PMDiego Medrano
11/18/2021, 7:05 PMkotlin {
// The drivers needed will change depending on what platforms you target:
sourceSets.androidMain.dependencies {
implementation "com.squareup.sqldelight:android-driver:1.5.2"
}
sourceSets.iosMain.dependencies {
implementation "com.squareup.sqldelight:native-driver:1.5.2"
}
}
Diego Medrano
11/18/2021, 7:06 PMAndrew O Hart
11/18/2021, 7:09 PMAndrew O Hart
11/18/2021, 7:10 PMDiego Medrano
11/18/2021, 7:23 PMAndrew O Hart
11/18/2021, 10:31 PMAndrew O Hart
11/18/2021, 10:31 PM