SPB Git

Repository Public License

Haptics.swift 1.2 KB 44 lines swift

1// ORIX Scan2// File: Packages/ORIXKit/Sources/ORIXDesign/Haptics.swift3// Description: The small, consistent haptic vocabulary of ORIX apps.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7import SwiftUI89#if canImport(UIKit)10import UIKit11#endif1213@MainActor14public enum ORIXHaptics {15    /// A discrete change (toggle, reorder drop, filter picked).16    public static func tick() {17        #if canImport(UIKit)18        UISelectionFeedbackGenerator().selectionChanged()19        #endif20    }21    /// A completed operation.22    public static func success() {23        #if canImport(UIKit)24        UINotificationFeedbackGenerator().notificationOccurred(.success)25        #endif26    }27    public static func warning() {28        #if canImport(UIKit)29        UINotificationFeedbackGenerator().notificationOccurred(.warning)30        #endif31    }32    public static func failure() {33        #if canImport(UIKit)34        UINotificationFeedbackGenerator().notificationOccurred(.error)35        #endif36    }37    /// A physical-feeling press (capture, primary action).38    public static func press() {39        #if canImport(UIKit)40        UIImpactFeedbackGenerator(style: .medium).impactOccurred()41        #endif42    }43}44
Files main
Menu

Theme