view LazyBear/Views/Search/CompanyList.swift @ 417:5f21f7c23c5e

Add comments and clean code
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Fri, 11 Jun 2021 11:37:42 +0200
parents dc8dccd18e86
children c78d5b5b3bda
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 {
    @Environment(\.presentationMode) static var presentationMode
    
    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")
            ]
        )
    }
}