I have lot of experience with other programming languages, but not so much in swift 3. I want to do polling loop. This is what i have written:
DispatchQueue.global(qos: .userInitiated).async {
[unowned self] in
while self.isRunning {
WebService.getPeople(completion: nil)
sleep(100)
}
}
This works fine for me, every 100 seconds, i do polling, and then make this thread sleep. What I am wondering, is this correct way to do this in swift 3?