From ae449f56459a57c6db7b0b1497c0cc5b0861202a Mon Sep 17 00:00:00 2001 From: Ameen Mustafa Date: Wed, 29 Sep 2021 12:19:19 -0600 Subject: [PATCH] added tick marks to the newReleasesSlider UISlider and snap functionality as detailed in issue 8. also fixed a typo. added tick marks to the newReleasesSlider UISlider and snap functionality as detailed in issue 8. also fixed a typo. --- .../RecentlyPlayedTracksViewModel.swift | 2 +- .../NewReleasesViewController.swift | 26 ++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/SpotifyRadar_iOS/App/Dashboard/Recently Played/RecentlyPlayedTracksViewModel.swift b/SpotifyRadar_iOS/App/Dashboard/Recently Played/RecentlyPlayedTracksViewModel.swift index a02c7ed..f275e37 100644 --- a/SpotifyRadar_iOS/App/Dashboard/Recently Played/RecentlyPlayedTracksViewModel.swift +++ b/SpotifyRadar_iOS/App/Dashboard/Recently Played/RecentlyPlayedTracksViewModel.swift @@ -65,7 +65,7 @@ RecentlyPlayedTracksViewModelOutput { self.dataManager = dataManager self.safariService = safariService - // Initializing utputs + // Initializing outputs title = Observable.just("Your Recently Played Tracks") trackCollections = sessionService.getRecentlyPlayedTracks(limit: 50) diff --git a/SpotifyRadar_iOS/App/New Releases/NewReleasesViewController.swift b/SpotifyRadar_iOS/App/New Releases/NewReleasesViewController.swift index 1c8baf4..75c2996 100644 --- a/SpotifyRadar_iOS/App/New Releases/NewReleasesViewController.swift +++ b/SpotifyRadar_iOS/App/New Releases/NewReleasesViewController.swift @@ -38,6 +38,7 @@ final class NewReleasesViewController: ViewControllerWithSideMenu, BindableType configureNavigationBar() configureTableView() setUpView() + createTickView() } deinit { @@ -63,6 +64,10 @@ final class NewReleasesViewController: ViewControllerWithSideMenu, BindableType newReleasesSlider.trailingAnchor.constraint(equalTo: layoutGuide.trailingAnchor, constant: -Constraints.outerMargins).isActive = true newReleasesSlider.heightAnchor.constraint(equalToConstant: Constraints.height).isActive = true + // adds target to method snap functionality on the newReleasesSlider UISlider + newReleasesSlider.addTarget(self, action: #selector(sliderChanged), for: .touchUpInside) + newReleasesSlider.isContinuous = false + tableView.topAnchor.constraint(equalTo: newReleasesSlider.bottomAnchor).isActive = true tableView.leadingAnchor.constraint(equalTo: layoutGuide.leadingAnchor).isActive = true tableView.trailingAnchor.constraint(equalTo: layoutGuide.trailingAnchor).isActive = true @@ -93,6 +98,24 @@ final class NewReleasesViewController: ViewControllerWithSideMenu, BindableType ) } + // creates the tick mark view and inserts it on top of the newReleasesSlider UISlider + private func createTickView() { + var tick : UIView + let tickArray = Array(1...12) + for i in 0..