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.")
}
}
Also in Swift:
- dequeueReusableCellWithIdentifier returns nil
- swiftui foreach
- text field passing data
- view will appear
- swift how to wait in a loop
- add to beginning of array swift
- swift toggle on change
- loop backwards swift
- how do i have countdown timer in swift stackoverflow
- swift change background color
- join arrays swift
- UISearchController keys
- swift set constraint programmatically
- remove padding hstack swiftui
- fade anumation swift
- swift quit app
- get device height spritekit
- rxswift map
- swift pop to specific view controller
- how to style textfield swiftui
- swift corner radious of view controller
- swift change navigation bar color
- hide status bar in tableview cell in swift
- xcode enable a button after a text field is filled