diff LazyBear/Views/Search/CompanyList.swift @ 340:d17dd5c28211

Implementing SearchView
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sat, 03 Apr 2021 17:46:05 +0200
parents
children 80bfa88c6b0f
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Views/Search/CompanyList.swift	Sat Apr 03 17:46:05 2021 +0200
@@ -0,0 +1,25 @@
+//
+//  CompanyList.swift
+//  LazyBear
+//
+//  Created by Dennis Concepción Martín on 3/4/21.
+//
+
+import SwiftUI
+
+struct CompanyList: View {
+    var searchResult: [SearchModel]
+    
+    var body: some View {
+        List(searchResult, id: \.self) { company in
+            CompanyRow(company: company)
+        }
+        .listStyle(GroupedListStyle())
+    }
+}
+
+struct CompanyList_Previews: PreviewProvider {
+    static var previews: some View {
+        CompanyList(searchResult: [SearchModel(securityName: "aaple inc", symbol: "aapl", region: "US", currency: "USD"), SearchModel(securityName: "aaple inc", symbol: "aapl", region: "US", currency: "USD"), SearchModel(securityName: "aaple inc", symbol: "aapl", region: "US", currency: "USD"), SearchModel(securityName: "aaple inc", symbol: "aapl", region: "US", currency: "USD"), SearchModel(securityName: "aaple inc", symbol: "aapl", region: "US", currency: "USD")])
+    }
+}