view LazyBear/Views/Search/CompanyList.swift @ 443:ffbb1dbab531

InsiderRosterHelper implemented
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Mon, 21 Jun 2021 20:17:46 +0200
parents 7f2a24a774eb
children
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!, name: company.securityName!)
                    .navigationTitle(company.symbol!.uppercased())
            ) {
                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")
            ]
        )
    }
}