From 50199bd3c4903143d6733bc3d9cfd5a885ff24b7 Mon Sep 17 00:00:00 2001 From: Harry-KNIGHT Date: Sun, 23 Apr 2023 21:10:30 +0200 Subject: [PATCH] Use switch instead if if else statements --- .../xcschemes/xcschememanagement.plist | 4 ++-- Stellar/View/Components/VideoPlaceHolderCell.swift | 1 - Stellar/View/Screens/FavoritesArticlesView.swift | 6 ++++-- Stellar/View/Screens/MainScreen.swift | 5 +++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Stellar.xcodeproj/xcuserdata/elliotknight.xcuserdatad/xcschemes/xcschememanagement.plist b/Stellar.xcodeproj/xcuserdata/elliotknight.xcuserdatad/xcschemes/xcschememanagement.plist index 022e68d..eabaaec 100644 --- a/Stellar.xcodeproj/xcuserdata/elliotknight.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Stellar.xcodeproj/xcuserdata/elliotknight.xcuserdatad/xcschemes/xcschememanagement.plist @@ -17,12 +17,12 @@ StellarNotificationServiceExtension.xcscheme_^#shared#^_ orderHint - 3 + 4 StellarStickers.xcscheme_^#shared#^_ orderHint - 4 + 3 StellarTests.xcscheme_^#shared#^_ diff --git a/Stellar/View/Components/VideoPlaceHolderCell.swift b/Stellar/View/Components/VideoPlaceHolderCell.swift index f2c5601..b093f43 100644 --- a/Stellar/View/Components/VideoPlaceHolderCell.swift +++ b/Stellar/View/Components/VideoPlaceHolderCell.swift @@ -17,7 +17,6 @@ struct VideoPlaceHolderCell: View { ZStack(alignment: .bottomLeading) { ZStack { RoundedRectangle(cornerRadius: 0) - .foregroundStyle(linearGradient) Image(systemName: "play.fill") .foregroundStyle(.white) diff --git a/Stellar/View/Screens/FavoritesArticlesView.swift b/Stellar/View/Screens/FavoritesArticlesView.swift index 32e8227..8f25765 100644 --- a/Stellar/View/Screens/FavoritesArticlesView.swift +++ b/Stellar/View/Screens/FavoritesArticlesView.swift @@ -12,9 +12,11 @@ struct FavoritesArticlesView: View { var body: some View { NavigationView { VStack { - if favoriteVM.favoriteArticles.isEmpty { + switch favoriteVM.favoriteArticles.isEmpty { + case true: EmptyView() - } else { + default: + FavoritesListView() } } diff --git a/Stellar/View/Screens/MainScreen.swift b/Stellar/View/Screens/MainScreen.swift index 1705f13..ecdd682 100644 --- a/Stellar/View/Screens/MainScreen.swift +++ b/Stellar/View/Screens/MainScreen.swift @@ -16,9 +16,10 @@ struct MainScreen: View { var body: some View { NavigationView { VStack { - if articleVm.articles.isEmpty { + switch articleVm.articles.isEmpty { + case true: LoadingView() - } else { + default: ArticlesGridView(showFavoritesSheet: $showFavoritesSheet, showBirthdayPicker: $showBirthdayPicker) } }