view LazyBear/Views/Search/CompanyList.swift @ 438:7f2a24a774eb

Implement CompanyView networking
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Sun, 20 Jun 2021 13:20:19 +0200
parents c78d5b5b3bda
children ffbb1dbab531
line wrap: on
line source

//
//  CompanyList.swift
//  LazyBear
//
//  Created by Dennis Concepción Martín on 3/4/21.
//

import SwiftUI

struct CompanyList: View {
    var searchResult: [SearchResponse]
    
    var body: some View {
        List(searchResult, id: \.self) { company in
//            NavigationLink(destination: CompanyView(symbol: company.symbol!)) {
                SearchedCompanyItem(company: company)
//            }
        }
    }
}

struct CompanyList_Previews: PreviewProvider {    
    static var previews: some View {
        CompanyList(searchResult:
            [
                SearchResponse(
                    currency: "USD",
                    region: "US",
                    securityName: "aaple inc",
                    symbol: "aapl"),
                SearchResponse(
                    currency: "USD",
                    region: "US",
                    securityName: "aaple inc",
                    symbol: "aapl"),
                SearchResponse(
                    currency: "USD",
                    region: "US",
                    securityName: "aaple inc",
                    symbol: "aapl"),
                SearchResponse(
                    currency: "USD",
                    region: "US",
                    securityName: "aaple inc",
                    symbol: "aapl"),
                SearchResponse(
                    currency: "USD",
                    region: "US",
                    securityName: "aaple inc",
                    symbol: "aapl")
            ]
        )
    }
}