Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created February 8, 2021 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sturdysturge/aa9b1176ba70e44553eea76fcae8712f to your computer and use it in GitHub Desktop.
Save sturdysturge/aa9b1176ba70e44553eea76fcae8712f to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@StateObject var dataModel = DataModel()
var body: some View {
if let tickers = dataModel.tickerData?.tickers
.sorted(by: { $0.market.name < $1.market.name }) {
NavigationView {
List(0..<tickers.count) { index in
if let ticker = tickers[index] {
NavigationLink(destination: TickerDetailView(index: index)
.environmentObject(dataModel)) {
Text("""
\(ticker.market.name)
\(ticker.base.rawValue) \(ticker.target)
""")
}
}
}
.navigationTitle("DOGE")
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment