Skip to content

Instantly share code, notes, and snippets.

View Callonski's full-sized avatar

Carl Engene Callonski

View GitHub Profile
@Callonski
Callonski / Main thread
Created September 20, 2017 14:37
For UI elements update
DispatchQueue.main.async(execute: {() -> Void in
})
// Enkelt animation
UIView.animate(withDuration: 1, animations: {
})
// Animera med funktion efter klar
UIView.animate(withDuration: 0.2, animations: {
// Animera
}) { _ in
// Klarkod
}
let request = NSMutableURLRequest(url: URL(string: "")!)
let session = URLSession.shared
request.httpMethod = "GET"
let task = session.dataTask(with: request as URLRequest, completionHandler: {data, response, error -> Void in
print("Response: \(String(describing: response))")
print(error.debugDescription)
if(error != nil)
{
return