Library / Taps & buttons

Tab bar / navigation selection

Switching tabs in a custom tab bar gives a subtle tick per change.

0ms 100ms 200ms 300ms 400ms
Feel
The quietest haptic available — a selection tick. Fires only when the tab actually changes.
APIs
.sensoryFeedback(.selection)UISelectionFeedbackGenerator
Minimum OS
iOS 17+ / iOS 10+
Raw .md
SwiftUI (iOS 17+)
import SwiftUI

struct CustomTabBar: View {
    @Binding var selected: Int
    let icons = ["house", "magnifyingglass", "bell", "person"]

    var body: some View {
        HStack {
            ForEach(icons.indices, id: \.self) { i in
                Button { selected = i } label: {
                    Image(systemName: icons[i])
                        .font(.title3)
                        .foregroundStyle(selected == i ? .primary : .tertiary)
                        .frame(maxWidth: .infinity)
                }
            }
        }
        .padding(.vertical, 12)
        .background(.bar)
        // Fires only when `selected` changes — repeat taps on the
        // same tab stay silent, which is the correct behavior.
        .sensoryFeedback(.selection, trigger: selected)
    }
}
UIKit
final class TabBarController: UITabBarController, UITabBarControllerDelegate {
    private let haptic = UISelectionFeedbackGenerator()

    override func viewDidLoad() {
        super.viewDidLoad()
        delegate = self
    }

    func tabBarController(_ tbc: UITabBarController,
                          didSelect viewController: UIViewController) {
        haptic.selectionChanged()
    }
}
Copied