Shared Project: Android app and iOS app sample apps

Some advances

  • In order to find the Documents folder on iOS app rather than using the Application/ \Support folder:

     // scan app sub-folders
     let userLocal:Folder=Sugar.IO.Folder.UserLocal()
     let parentPath:String=Path.GetParentDirectory( Path.GetParentDirectory(userLocal.Path) );
     writeLn ( "Scanning \(parentPath)..." )
     let folders:String[]=Sugar.io.FolderUtils.GetFolders(parentPath,false);
     for f in folders {
        if f.EndsWith("Documents") {
           writeLn("Documents folder \(f)");
        }
     }
    

.

  • According to SQLiteQueryResult handling explained in Sugar.Data: Handling SQLiteConnection, SQLiteQueryResult, SQLiteException in Swift/Silver
    to handle a ResultSet cursor:

                      do {
     			
                             // insert example
     			let INSERT = "INSERT OR REPLACE INTO CACHE (cache_key, cache_value, timestamp) VALUES (?,?,?);";
     			conn.Execute(INSERT,["KEY","PIPPO","20150101"]);
    
     			// select example
     			let SELECT = "SELECT * from CACHE"
     			let result:SQLiteQueryResult=conn.ExecuteQuery(SELECT);
     			while result.MoveNext() {
     				writeLn( result.GetString( 0 ) ); // col1
     				writeLn( result.GetString( 1 ) ); // col2
     				writeLn( result.GetString( 2 ) ); // col3
     			}
     		} catch let error as SQLiteException {
     			writeLn("sql error");
     			writeLn( error.description.ToString() );
     		}