comparison LazyBear/Views/Company/Helpers/NewsList.swift @ 445:7d1c4dc8d1d8

Change presentationMode to Binding
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Tue, 22 Jun 2021 19:56:59 +0200
parents ffbb1dbab531
children 8621ba6fd457
comparison
equal deleted inserted replaced
444:428109b1e3f0 445:7d1c4dc8d1d8
7 7
8 import SwiftUI 8 import SwiftUI
9 9
10 struct NewsList: View { 10 struct NewsList: View {
11 var latestNews: [LatestNewsModel] 11 var latestNews: [LatestNewsModel]
12 @Environment(\.presentationMode) private var newsListPresentation 12 @Binding var isPresented: Bool
13 13
14 var body: some View { 14 var body: some View {
15 NavigationView { 15 NavigationView {
16 ScrollView(showsIndicators: false) { 16 ScrollView(showsIndicators: false) {
17 VStack { 17 VStack {
27 .padding() 27 .padding()
28 } 28 }
29 .navigationTitle("Latest news") 29 .navigationTitle("Latest news")
30 .toolbar { 30 .toolbar {
31 ToolbarItem(placement: .cancellationAction) { 31 ToolbarItem(placement: .cancellationAction) {
32 Button(action: { newsListPresentation.wrappedValue.dismiss() }) { 32 Button(action: { self.isPresented.toggle() }) {
33 Image(systemName: "multiply") 33 Image(systemName: "multiply")
34 } 34 }
35 } 35 }
36 } 36 }
37 } 37 }
48 image: "https://cloud.iexapis.com/v1/news/image/99abeb99-6d9e-47c8-ae7b-53404eacccec", 48 image: "https://cloud.iexapis.com/v1/news/image/99abeb99-6d9e-47c8-ae7b-53404eacccec",
49 source: "Investing.com", 49 source: "Investing.com",
50 summary: "https://www.investing.com/news/stock-market-news", 50 summary: "https://www.investing.com/news/stock-market-news",
51 url: "https://cloud.iexapis.com/v1/news/article/99abeb99-6d9e-47c8-ae7b-53404eacccec") 51 url: "https://cloud.iexapis.com/v1/news/article/99abeb99-6d9e-47c8-ae7b-53404eacccec")
52 ] 52 ]
53 , isPresented: .constant(true)
53 ) 54 )
54 } 55 }
55 } 56 }