experiment(BookmarkRow): add sensoryFeedback haptic on podcast trigger button
This commit is contained in:
@@ -5,6 +5,8 @@ struct BookmarkRow: View {
|
|||||||
var readingProgress: Double = 0
|
var readingProgress: Double = 0
|
||||||
var onPodcast: (() -> Void)? = nil
|
var onPodcast: (() -> Void)? = nil
|
||||||
|
|
||||||
|
@State private var podcastTapCount = 0
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading, spacing: 6) {
|
VStack(alignment: .leading, spacing: 6) {
|
||||||
HStack(alignment: .top, spacing: 11) {
|
HStack(alignment: .top, spacing: 11) {
|
||||||
@@ -34,13 +36,17 @@ struct BookmarkRow: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if let onPodcast {
|
if let onPodcast {
|
||||||
Button(action: onPodcast) {
|
Button {
|
||||||
|
podcastTapCount += 1
|
||||||
|
onPodcast()
|
||||||
|
} label: {
|
||||||
Image(systemName: podcastCached ? "headphones.circle.fill" : "headphones.circle")
|
Image(systemName: podcastCached ? "headphones.circle.fill" : "headphones.circle")
|
||||||
.font(.system(size: 26))
|
.font(.system(size: 26))
|
||||||
.foregroundStyle(podcastCached ? .blue : Color(.systemGray3))
|
.foregroundStyle(podcastCached ? .blue : Color(.systemGray3))
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.padding(.top, 1)
|
.padding(.top, 1)
|
||||||
|
.sensoryFeedback(.impact(weight: .medium), trigger: podcastTapCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user