view LazyBear/Views/Search/CompanyList.swift @ 389:db8bc3ed526a

Implementing add to watchlist feature from SearchView
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sun, 25 Apr 2021 16:42:26 +0200
parents 280cbc5653b5
children 6303385b3629
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: Text("Hello")) {
                SearchedCompanyItem(company: company)
            }
        }
        .listStyle(GroupedListStyle())
    }
}

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")])
    }
}