changeset 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 428109b1e3f0
children 9cc0455bc46f
files LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate LazyBear/Views/Company/Helpers/InsiderRosterList.swift LazyBear/Views/Company/Helpers/InsiderTransactionsHelper.swift LazyBear/Views/Company/Helpers/InsiderTransactionsList.swift LazyBear/Views/Company/Helpers/KeyStatsHelper.swift LazyBear/Views/Company/Helpers/KeyStatsList.swift LazyBear/Views/Company/Helpers/NewsHelper.swift LazyBear/Views/Company/Helpers/NewsList.swift
diffstat 8 files changed, 16 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
Binary file LazyBear.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/LazyBear/Views/Company/Helpers/InsiderRosterList.swift	Tue Jun 22 16:54:21 2021 +0200
+++ b/LazyBear/Views/Company/Helpers/InsiderRosterList.swift	Tue Jun 22 19:56:59 2021 +0200
@@ -9,7 +9,7 @@
 
 struct InsiderRosterList: View {
     var insiderRoster: [InsiderRosterModel]
-    @Environment(\.presentationMode) private var insiderRosterListPresentation
+    @Binding var isPresented: Bool
         
     var body: some View {
         NavigationView {
@@ -27,7 +27,7 @@
             .navigationTitle("Top 10 Insiders")
             .toolbar {
                 ToolbarItem(placement: .cancellationAction) {
-                    Button(action: { insiderRosterListPresentation.wrappedValue.dismiss() }) {
+                    Button(action: { self.isPresented.toggle() }) {
                         Image(systemName: "multiply")
                     }
                 }
@@ -47,6 +47,7 @@
                         reportDate: 12345
                     )
                 ]
+            , isPresented: .constant(true)
         )
     }
 }
--- a/LazyBear/Views/Company/Helpers/InsiderTransactionsHelper.swift	Tue Jun 22 16:54:21 2021 +0200
+++ b/LazyBear/Views/Company/Helpers/InsiderTransactionsHelper.swift	Tue Jun 22 19:56:59 2021 +0200
@@ -33,7 +33,7 @@
             CustomRectangleBox()
         )
         .sheet(isPresented: $showList) {
-            InsiderTransactionsList(insiderTransactions: insiderTransactions)
+            InsiderTransactionsList(insiderTransactions: insiderTransactions, isPresented: $showList)
         }
     }
 }
--- a/LazyBear/Views/Company/Helpers/InsiderTransactionsList.swift	Tue Jun 22 16:54:21 2021 +0200
+++ b/LazyBear/Views/Company/Helpers/InsiderTransactionsList.swift	Tue Jun 22 19:56:59 2021 +0200
@@ -9,7 +9,7 @@
 
 struct InsiderTransactionsList: View {
     var insiderTransactions: [InsiderTransactionModel]
-    @Environment(\.presentationMode) private var insiderTransactionsListPresentation
+    @Binding var isPresented: Bool
     
     var body: some View {
         NavigationView {
@@ -25,7 +25,7 @@
             .navigationTitle("Insider Transactions")
             .toolbar {
                 ToolbarItem(placement: .cancellationAction) {
-                    Button(action: { insiderTransactionsListPresentation.wrappedValue.dismiss() }) {
+                    Button(action: { self.isPresented.toggle() }) {
                         Image(systemName: "multiply")
                     }
                 }
@@ -50,6 +50,7 @@
                         transactionValue: 1234567.0
                     )
                 ]
+            , isPresented: .constant(true)
         )
     }
 }
--- a/LazyBear/Views/Company/Helpers/KeyStatsHelper.swift	Tue Jun 22 16:54:21 2021 +0200
+++ b/LazyBear/Views/Company/Helpers/KeyStatsHelper.swift	Tue Jun 22 19:56:59 2021 +0200
@@ -54,7 +54,7 @@
                 .padding(.horizontal)
             }
             .sheet(isPresented: $showList) {
-                KeyStatsList(keyStats: keyStats)
+                KeyStatsList(keyStats: keyStats, isPresented: $showList)
             }
         }
     }
--- a/LazyBear/Views/Company/Helpers/KeyStatsList.swift	Tue Jun 22 16:54:21 2021 +0200
+++ b/LazyBear/Views/Company/Helpers/KeyStatsList.swift	Tue Jun 22 19:56:59 2021 +0200
@@ -9,9 +9,8 @@
 
 struct KeyStatsList: View {
     var keyStats: KeyStatsModel
-    
+    @Binding var isPresented: Bool
     let displayWords: DisplayWordsModel = parseJSON("DisplayWords.json")
-    @Environment(\.presentationMode) var keyStatsListPresentation
     
     var body: some View {
         NavigationView {
@@ -37,7 +36,7 @@
             .navigationTitle("Key Stats")
             .toolbar {
                 ToolbarItem(placement: .navigationBarLeading) {
-                    Button(action: { keyStatsListPresentation.wrappedValue.dismiss() }) {
+                    Button(action: { self.isPresented.toggle() }) {
                         Image(systemName: "multiply")
                     }
                         
@@ -96,7 +95,8 @@
                             exDividendDate: "2020-01-01",
                             nextDividendDate: "2020-01-01",
                             nextEarningsDate: "2020-01-01"
-                    )
+                        )
+                     , isPresented: .constant(true)
                 )
     }
 }
--- a/LazyBear/Views/Company/Helpers/NewsHelper.swift	Tue Jun 22 16:54:21 2021 +0200
+++ b/LazyBear/Views/Company/Helpers/NewsHelper.swift	Tue Jun 22 19:56:59 2021 +0200
@@ -37,7 +37,7 @@
             CustomRectangleBox()
         )
         .sheet(isPresented: $showList) {
-            NewsList(latestNews: latestNews)
+            NewsList(latestNews: latestNews, isPresented: $showList)
         }
     }
 }
--- a/LazyBear/Views/Company/Helpers/NewsList.swift	Tue Jun 22 16:54:21 2021 +0200
+++ b/LazyBear/Views/Company/Helpers/NewsList.swift	Tue Jun 22 19:56:59 2021 +0200
@@ -9,7 +9,7 @@
 
 struct NewsList: View {
     var latestNews: [LatestNewsModel]
-    @Environment(\.presentationMode) private var newsListPresentation
+    @Binding var isPresented: Bool
     
     var body: some View {
         NavigationView {
@@ -29,7 +29,7 @@
             .navigationTitle("Latest news")
             .toolbar {
                 ToolbarItem(placement: .cancellationAction) {
-                    Button(action: { newsListPresentation.wrappedValue.dismiss() }) {
+                    Button(action: { self.isPresented.toggle() }) {
                         Image(systemName: "multiply")
                     }
                 }
@@ -50,6 +50,7 @@
                     summary: "https://www.investing.com/news/stock-market-news",
                     url: "https://cloud.iexapis.com/v1/news/article/99abeb99-6d9e-47c8-ae7b-53404eacccec")
             ]
+            , isPresented: .constant(true)
         )
     }
 }