From 54878e67012435934f686595028a7719b8560523 Mon Sep 17 00:00:00 2001 From: Lee Jun Kit Date: Sat, 5 Jun 2021 17:35:56 +0800 Subject: [PATCH] fix progress slider onEditingChanged randomly --- Spottie.xcodeproj/project.pbxproj | 16 ++++++++++++---- Spottie/ViewModels/PlayerViewModel.swift | 2 +- Spottie/Views/{ => BottomBar}/BottomBar.swift | 0 .../NextTrackButton.swift | 0 .../{Components => BottomBar}/NowPlaying.swift | 0 .../PlayPauseButton.swift | 0 .../PlayerControls.swift | 0 .../PreviousTrackButton.swift | 0 .../{Components => BottomBar}/RepeatButton.swift | 0 .../ShuffleButton.swift | 0 .../TrackProgressSlider.swift | 0 .../{Components => BottomBar}/VolumeSlider.swift | 0 Spottie/Views/Search.swift | 16 +++++++++++++++- 13 files changed, 28 insertions(+), 6 deletions(-) rename Spottie/Views/{ => BottomBar}/BottomBar.swift (100%) rename Spottie/Views/{Components => BottomBar}/NextTrackButton.swift (100%) rename Spottie/Views/{Components => BottomBar}/NowPlaying.swift (100%) rename Spottie/Views/{Components => BottomBar}/PlayPauseButton.swift (100%) rename Spottie/Views/{Components => BottomBar}/PlayerControls.swift (100%) rename Spottie/Views/{Components => BottomBar}/PreviousTrackButton.swift (100%) rename Spottie/Views/{Components => BottomBar}/RepeatButton.swift (100%) rename Spottie/Views/{Components => BottomBar}/ShuffleButton.swift (100%) rename Spottie/Views/{Components => BottomBar}/TrackProgressSlider.swift (100%) rename Spottie/Views/{Components => BottomBar}/VolumeSlider.swift (100%) diff --git a/Spottie.xcodeproj/project.pbxproj b/Spottie.xcodeproj/project.pbxproj index 737e813..d0be6a2 100644 --- a/Spottie.xcodeproj/project.pbxproj +++ b/Spottie.xcodeproj/project.pbxproj @@ -170,20 +170,21 @@ 4730615D26565706001E3A1F /* Views */ = { isa = PBXGroup; children = ( - 4730616626565AF8001E3A1F /* Components */, + 474BAFBD266B79900006EB16 /* Carousel */, + 4730616626565AF8001E3A1F /* BottomBar */, 4730614F265656ED001E3A1F /* ContentView.swift */, 4730615E2656573B001E3A1F /* Sidebar.swift */, 473061602656580F001E3A1F /* Home.swift */, 4730616226565828001E3A1F /* Search.swift */, 4730616426565841001E3A1F /* Library.swift */, - 4730616926565BB7001E3A1F /* BottomBar.swift */, ); path = Views; sourceTree = ""; }; - 4730616626565AF8001E3A1F /* Components */ = { + 4730616626565AF8001E3A1F /* BottomBar */ = { isa = PBXGroup; children = ( + 4730616926565BB7001E3A1F /* BottomBar.swift */, 470201C9265CF9380030ECA9 /* ShuffleButton.swift */, 4730616726565B03001E3A1F /* PlayPauseButton.swift */, 470201BE265BB4320030ECA9 /* PreviousTrackButton.swift */, @@ -194,7 +195,7 @@ 470201CD265DE8720030ECA9 /* TrackProgressSlider.swift */, 474BAFB7266876030006EB16 /* VolumeSlider.swift */, ); - path = Components; + path = BottomBar; sourceTree = ""; }; 4730616B26565EB8001E3A1F /* Backend */ = { @@ -275,6 +276,13 @@ path = API; sourceTree = ""; }; + 474BAFBD266B79900006EB16 /* Carousel */ = { + isa = PBXGroup; + children = ( + ); + path = Carousel; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ diff --git a/Spottie/ViewModels/PlayerViewModel.swift b/Spottie/ViewModels/PlayerViewModel.swift index 31b6cf2..76fe3fa 100644 --- a/Spottie/ViewModels/PlayerViewModel.swift +++ b/Spottie/ViewModels/PlayerViewModel.swift @@ -11,7 +11,7 @@ import Combine class PlayerViewModel: PlayerStateProtocol { @Published var volumePercent: Float = 0.0 @Published var isPlaying = false - @Published var durationMs = 0 + @Published var durationMs = 1 @Published var progressMs = 0 @Published var trackName = "" @Published var artistName = "" diff --git a/Spottie/Views/BottomBar.swift b/Spottie/Views/BottomBar/BottomBar.swift similarity index 100% rename from Spottie/Views/BottomBar.swift rename to Spottie/Views/BottomBar/BottomBar.swift diff --git a/Spottie/Views/Components/NextTrackButton.swift b/Spottie/Views/BottomBar/NextTrackButton.swift similarity index 100% rename from Spottie/Views/Components/NextTrackButton.swift rename to Spottie/Views/BottomBar/NextTrackButton.swift diff --git a/Spottie/Views/Components/NowPlaying.swift b/Spottie/Views/BottomBar/NowPlaying.swift similarity index 100% rename from Spottie/Views/Components/NowPlaying.swift rename to Spottie/Views/BottomBar/NowPlaying.swift diff --git a/Spottie/Views/Components/PlayPauseButton.swift b/Spottie/Views/BottomBar/PlayPauseButton.swift similarity index 100% rename from Spottie/Views/Components/PlayPauseButton.swift rename to Spottie/Views/BottomBar/PlayPauseButton.swift diff --git a/Spottie/Views/Components/PlayerControls.swift b/Spottie/Views/BottomBar/PlayerControls.swift similarity index 100% rename from Spottie/Views/Components/PlayerControls.swift rename to Spottie/Views/BottomBar/PlayerControls.swift diff --git a/Spottie/Views/Components/PreviousTrackButton.swift b/Spottie/Views/BottomBar/PreviousTrackButton.swift similarity index 100% rename from Spottie/Views/Components/PreviousTrackButton.swift rename to Spottie/Views/BottomBar/PreviousTrackButton.swift diff --git a/Spottie/Views/Components/RepeatButton.swift b/Spottie/Views/BottomBar/RepeatButton.swift similarity index 100% rename from Spottie/Views/Components/RepeatButton.swift rename to Spottie/Views/BottomBar/RepeatButton.swift diff --git a/Spottie/Views/Components/ShuffleButton.swift b/Spottie/Views/BottomBar/ShuffleButton.swift similarity index 100% rename from Spottie/Views/Components/ShuffleButton.swift rename to Spottie/Views/BottomBar/ShuffleButton.swift diff --git a/Spottie/Views/Components/TrackProgressSlider.swift b/Spottie/Views/BottomBar/TrackProgressSlider.swift similarity index 100% rename from Spottie/Views/Components/TrackProgressSlider.swift rename to Spottie/Views/BottomBar/TrackProgressSlider.swift diff --git a/Spottie/Views/Components/VolumeSlider.swift b/Spottie/Views/BottomBar/VolumeSlider.swift similarity index 100% rename from Spottie/Views/Components/VolumeSlider.swift rename to Spottie/Views/BottomBar/VolumeSlider.swift diff --git a/Spottie/Views/Search.swift b/Spottie/Views/Search.swift index dfd93e9..989a46c 100644 --- a/Spottie/Views/Search.swift +++ b/Spottie/Views/Search.swift @@ -8,8 +8,22 @@ import SwiftUI struct Search: View { + let rows: [GridItem] = + Array(repeating: .init(.fixed(20)), count: 2) var body: some View { - Text("Hello, Search!") + ScrollView(.horizontal) { + LazyHGrid(rows: rows, alignment: .top) { + ForEach((0...79), id: \.self) { + let codepoint = $0 + 0x1f600 + let codepointString = String(format: "%02X", codepoint) + Text("\(codepointString)") + .font(.footnote) + let emoji = String(Character(UnicodeScalar(codepoint)!)) + Text("\(emoji)") + .font(.largeTitle) + } + } + } } }