mafioso mafioso - 8 months ago 75
Swift Question

How to refresh photo gallery in swift?

How can I refresh the photo gallery in swift? If I take a picture I have to close the app and then restart it to see it. I want to refresh the gallery automatically. What's the best way to solve this problem?


Add this to your viewDidLoad method:
NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: #selector(ViewController.refreshView), userInfo: nil, repeats: true) and implement in the refreshView what you want to do.

Better method: use an observer pattern!