mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-06-26 09:00:34 +00:00
Haptic feedback when refreshing timeline
This commit is contained in:
parent
5bc262da33
commit
789adc8b22
|
@ -18,6 +18,8 @@ public struct TimelineView: View {
|
||||||
@StateObject private var viewModel = TimelineViewModel()
|
@StateObject private var viewModel = TimelineViewModel()
|
||||||
@Binding var timeline: TimelineFilter
|
@Binding var timeline: TimelineFilter
|
||||||
|
|
||||||
|
private let feedbackGenerator = UIImpactFeedbackGenerator()
|
||||||
|
|
||||||
public init(timeline: Binding<TimelineFilter>) {
|
public init(timeline: Binding<TimelineFilter>) {
|
||||||
_timeline = timeline
|
_timeline = timeline
|
||||||
}
|
}
|
||||||
|
@ -46,7 +48,9 @@ public struct TimelineView: View {
|
||||||
viewModel.timeline = timeline
|
viewModel.timeline = timeline
|
||||||
}
|
}
|
||||||
.refreshable {
|
.refreshable {
|
||||||
|
feedbackGenerator.impactOccurred(intensity: 0.3)
|
||||||
await viewModel.fetchStatuses(userIntent: true)
|
await viewModel.fetchStatuses(userIntent: true)
|
||||||
|
feedbackGenerator.impactOccurred(intensity: 0.7)
|
||||||
}
|
}
|
||||||
.onChange(of: watcher.latestEvent?.id) { id in
|
.onChange(of: watcher.latestEvent?.id) { id in
|
||||||
if let latestEvent = watcher.latestEvent {
|
if let latestEvent = watcher.latestEvent {
|
||||||
|
|
Loading…
Reference in a new issue