0
I made an app on Android and am making a version of it for IOS currently, I would like to know how I could implement an Assynctask on Swift and run.
On Android I did this way:
public void carregaBanner2(){ new LongOperation3().execute("");}
private class LongOperation3 extends AsyncTask<String, Void, String> {
public char getChar(char x){return x;}
@Override
protected String doInBackground(String... params) {
try {
//o que quero executar. . .
Thread.sleep(1000);
} catch (Exception e) {
Log.e("log_tag", "Error in http connection "
+ e.toString());
}
return null;
}
@Override
protected void onPostExecute(String result) {
try {
//depois de executado. . .
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
protected void onPreExecute() {
//Antes de executar. . .
}
@Override
protected void onProgressUpdate(Void... values) {
}
}