Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import Combine
import Foundation
import UIKit
class DataModel: ObservableObject {
static let url = URL(string: "")!
static let imageURL = URL(string: "" +
"X-Zf_cxcp7v0EzRWQSG15blQWcsWUwa7wfVIVziAUc.jpg" +
@Published var tickerData: TickerData?
@Published var image: UIImage?
@Published var lastRefreshed = ""
func refresh() {
Self.url.getFromPublisher(property: &$tickerData)
lastRefreshed = "Last refreshed: \(Date.currentTime)"
init() {
if let data = try? Data(contentsOf: Self.imageURL) {
image = UIImage(data: data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment