Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

swift how to wait in a loop

override func viewDidLoad() {
    super.viewDidLoad()

    let myGroup = DispatchGroup()

    for i in 0 ..< 5 {
        myGroup.enter()

        Alamofire.request("https://httpbin.org/get", parameters: ["foo": "bar"]).responseJSON { response in
            print("Finished request (i)")
            myGroup.leave()
        }
    }

    myGroup.notify(queue: .main) {
        print("Finished all requests.")
    }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: swift disable modal dismiss swift 
Swift :: ring Desktop, WebAssembly and Mobile Using QTableWidget 
Swift :: Customize indicator view iOS swift 
Swift :: Swift Bitwise XOR Operator 
Swift :: Swift Join Two Strings 
Swift :: table flutter stackoverflow 
Swift :: editbutton swiftui color text 
Swift :: int in swift 
Swift :: Swift convenience Initializer 
Swift :: How to create a typealias? 
Swift :: Rules for naming Swift Variables 
Swift :: Swift Bitwise NOT Operator 
Swift :: dfghbghjjmyuhjtdcfbjj 
Swift :: change multiplier programactlilly ios swift 
Swift :: swift api call certificate 
Swift :: How to load Google map styling from json file for ios swift? 
Swift :: Named Associated Values Swift 
Swift :: swift animate constraint 
Swift :: remove child from scene swift 
Swift :: swift toggle on change 
Ruby :: validates length rails 
Ruby :: command to run all rspec tests 
Ruby :: array ruby taking 3 last value 
Ruby :: devise redirectt after sign up 
Ruby :: add timezone in rails 
Ruby :: rails naming conventions controller 
Ruby :: ruby string to symbol 
Ruby :: add edit or --wait for rails credentials edit windows 
Ruby :: ruby hash.each 
Ruby :: ruby pry syntax 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =