diff --git a/TidalSwift.xcodeproj/project.pbxproj b/TidalSwift.xcodeproj/project.pbxproj index d44e574..970b523 100644 --- a/TidalSwift.xcodeproj/project.pbxproj +++ b/TidalSwift.xcodeproj/project.pbxproj @@ -715,7 +715,6 @@ B0A67AA62395CB1100BD3921 /* WrappedTrack.swift */, B0A67AAC2395DB6700BD3921 /* Pasteboard.swift */, B0E8B8D824D5D3F60093A706 /* SecondsToHoursMinutesSecondsString.swift */, - B0D62EA324E49D4D00F5AD4D /* TouchBarView.swift */, ); path = Helpers; sourceTree = ""; @@ -749,6 +748,7 @@ B0D974D4230CD60D00695388 /* PlayerInfoView.swift */, B0D974CC230CC1D200695388 /* Favorites.swift */, B0617B3423C436C600CD59A3 /* OfflineOverviews.swift */, + B0D62EA324E49D4D00F5AD4D /* TouchBarView.swift */, ); path = "Top-Level Views"; sourceTree = ""; diff --git a/TidalSwift/Helpers/TouchBarView.swift b/TidalSwift/Helpers/TouchBarView.swift deleted file mode 100644 index de81825..0000000 --- a/TidalSwift/Helpers/TouchBarView.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// TouchBarView.swift -// TidalSwift -// -// Created by Melvin Gundlach on 12.08.20. -// Copyright © 2020 Melvin Gundlach. All rights reserved. -// - -import SwiftUI - -struct TouchBarView: View { - let player: Player - @ObservedObject var playbackInfo: PlaybackInfo - - var body: some View { - Group { - Button(action: { - player.previous() - }) { - Text("Backward") - } - if playbackInfo.playing { - Button(action: { - player.pause() - }) { - Text("Pause") - } - } else { - Button(action: { - player.play() - }) { - Text("Play") - } - } - Button(action: { - player.next() - }) { - Text("Forward") - } - Slider(value: $playbackInfo.fraction) { ended in - if ended { - player.seek(to: Double(playbackInfo.fraction)) - } - } - } - } -} diff --git a/TidalSwift/Top-Level Views/PlayerInfoView.swift b/TidalSwift/Top-Level Views/PlayerInfoView.swift index 2ec3eb7..10c4672 100644 --- a/TidalSwift/Top-Level Views/PlayerInfoView.swift +++ b/TidalSwift/Top-Level Views/PlayerInfoView.swift @@ -230,8 +230,8 @@ struct ProgressBar: View { @Environment(\.colorScheme) var colorScheme: ColorScheme var body: some View { - ValueSlider(value: $playbackInfo.fraction) { ended in - if ended { + ValueSlider(value: $playbackInfo.fraction) { down in + if down { // Only apply while scrubbing, not when releasing player.seek(to: Double(playbackInfo.fraction)) } } diff --git a/TidalSwift/Top-Level Views/TouchBarView.swift b/TidalSwift/Top-Level Views/TouchBarView.swift new file mode 100644 index 0000000..1f90531 --- /dev/null +++ b/TidalSwift/Top-Level Views/TouchBarView.swift @@ -0,0 +1,45 @@ +// +// TouchBarView.swift +// TidalSwift +// +// Created by Melvin Gundlach on 12.08.20. +// Copyright © 2020 Melvin Gundlach. All rights reserved. +// + +import SwiftUI + +struct TouchBarView: View { + let player: Player + @ObservedObject var playbackInfo: PlaybackInfo + + var body: some View { + Button(action: { + player.previous() + }) { + Text("Backward") + } + if playbackInfo.playing { + Button(action: { + player.pause() + }) { + Text("Pause") + } + } else { + Button(action: { + player.play() + }) { + Text("Play") + } + } + Button(action: { + player.next() + }) { + Text("Forward") + } + Slider(value: $playbackInfo.fraction) { down in + if !down { // Only apply on finger lift + player.seek(to: Double(playbackInfo.fraction)) + } + } + } +}