Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SWIFT

do something when your HTTP response finishes. swift

import Foundation

<...>

var done = false

let task = session.dataTask(with: request as URLRequest) {
    (data, response, error) in

    <...>
    done = true
}

task.resume()

repeat {
    RunLoop.current.run(until: Date(timeIntervalSinceNow: 0.1))
} while !done

//credits https://stackoverflow.com/users/539599/raphael
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #HTTP #response #swift
ADD COMMENT
Topic
Name
3+6 =