So I am not sure how to make the quote update ones daily at the same time for all users not depending on the last time they opened the app? If I am not specific enough or anything let me know. Thanks:)
let tasks = URLSession.shared.dataTask(with: URL(string: "https://talaikis.com/api/quotes/random/")!) { (data, response, error) in
if error != nil {
print("error")
} else {
if let content = data {
do {
let Json = try JSONSerialization.jsonObject(with: content, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject
if let data = Json as? [AnyHashable:Any] {
if let quote = data["quote"], let cat = data["cat"], let author = data["author"] as? String {
print(cat)
DispatchQueue.main.async {
self.myLabel.text = "\(quote)"
self.authorLabel.text = "\(author)"
}
}
}
} catch {
}
}
}
}
tasks.resume()