From 004ea92dac345b2adc8a169f6155953d4a6e7ffb Mon Sep 17 00:00:00 2001 From: sangu_80 Date: Sat, 8 Aug 2020 23:56:32 +0530 Subject: [PATCH] Add a section to allow the user to save his/her favourite skills #322 struct landmarkList : View { @state var showFavoritesOnly = false var body : some View{ NavigationView{ List(landmarkData) { landmark in if !self,showFavoritesOnly || landmark.isFavorite { NavigaitonLink(destination: LandmarkDetail(landmark: landmark)) Landmarkrow(landmark: landmark) } } .navigationBarTitle(Text("Landmarks")) } } --- .../SkillListingVCMethods.swift | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Susi/Controllers/SkillListingViewController/SkillListingVCMethods.swift b/Susi/Controllers/SkillListingViewController/SkillListingVCMethods.swift index 01a30029..559c7142 100644 --- a/Susi/Controllers/SkillListingViewController/SkillListingVCMethods.swift +++ b/Susi/Controllers/SkillListingViewController/SkillListingVCMethods.swift @@ -42,6 +42,29 @@ extension SkillListingViewController { let nvc = AppNavigationController(rootViewController: vc!) present(nvc, animated: true, completion: nil) } + if landmark.isFavorite { + image(systemName : "star.fill") + .imageScale(.medium) + .forebackgroundColor(.yellow) + } + + struct landmarkList : View { + @state var showFavoritesOnly = false + + var body : some View{ + NavigationView{ + List(landmarkData) { landmark in + if !self,showFavoritesOnly || landmark.isFavorite { + NavigaitonLink(destination: LandmarkDetail(landmark: landmark)) + Landmarkrow(landmark: landmark) + + } + } + } + .navigationBarTitle(Text("Landmarks")) + } + } + } // presents the settings controller @objc func presentSettingsController() {