Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Swift :: Swift Create static type Singleton Object 
Swift :: Swift if...else 
Swift :: swift constraints 
Swift :: Swift Labeled Statement with break 
Swift :: Trailing Closure Swift 
Swift :: swift_SmtpTransport with oauth2 
Swift :: protocol oriented programming 
Swift :: swift string pad 
Swift :: ternary operator in swift 
Swift :: library not found for -lalan-sdk-react-native 
Swift :: Swift Assign Values to Variables 
Swift :: where to save audio asset swift 
Swift :: load plist swift 
Swift :: swift Equatable 
Ruby :: how to remove columns from rails 
Ruby :: hashwithindifferentaccess ruby 
Ruby :: devise add trackable 
Ruby :: fibonacci sums ruby 
Ruby :: rspec add support folder 
Ruby :: Your Ruby version is 2.7.0, but your Gemfile specified 2.7.1 
Ruby :: rails string to date 
Ruby :: rails date format dd/mm/yyyy 
Ruby :: ruby create csv 
Ruby :: uper case in ruby 
Ruby :: rails logger stdout 
Ruby :: rbenv and ruby different versions 
Ruby :: ruby rails delete all of a model in console 
Ruby :: how works httparty ruby 
Ruby :: ruby abs function programming 
Ruby :: ruby string format 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =