comparison Simoleon/Favorites.swift @ 84:98852b65438c

Changed placeholder when Core Data is empty
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Sun, 01 Aug 2021 12:17:51 +0100
parents b6f8661300f2
children 529feb1fc8d5
comparison
equal deleted inserted replaced
83:c07148805f15 84:98852b65438c
15 15
16 var body: some View { 16 var body: some View {
17 VStack { 17 VStack {
18 if favorite.isEmpty { 18 if favorite.isEmpty {
19 Group { 19 Group {
20 Text("Tap ") + Text(Image(systemName: "star")) 20 Image(systemName: "star")
21 Text("to add a currency pair to favorites") 21 .font(.title)
22 Text("Search a currency pair and add it to favourites.")
22 .padding(.top, 5) 23 .padding(.top, 5)
23 } 24 }
25 .multilineTextAlignment(.center)
24 .foregroundColor(Color(.systemGray)) 26 .foregroundColor(Color(.systemGray))
27 .padding(.horizontal, 50)
25 } else { 28 } else {
26 List { 29 List {
27 ForEach(favorite) { favorite in 30 ForEach(favorite) { favorite in
28 NavigationLink(destination: Conversion(showNavigationView: false, currencyPair: favorite.currencyPair)) { 31 NavigationLink(destination: Conversion(showNavigationView: false, currencyPair: favorite.currencyPair)) {
29 CurrencyRow(currencyPairName: favorite.currencyPair) 32 CurrencyRow(currencyPairName: favorite.currencyPair)
60 } 63 }
61 64
62 struct Favorites_Previews: PreviewProvider { 65 struct Favorites_Previews: PreviewProvider {
63 static var previews: some View { 66 static var previews: some View {
64 Favorites() 67 Favorites()
65 .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) 68 // .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext)
66 } 69 }
67 } 70 }