Component

Haptic Feedback

Learn to add Haptic Feedback to your iOS App (Supports Xcode 16 and iOS 18)

Haptic Feedback

Just copy the below code and modify according to your needs.

struct HomeView: View {
    let lightFeedback = UIImpactFeedbackGenerator(style: .light) // Change style
    let mediumFeedback = UIImpactFeedbackGenerator(style: .medium)
    let heavyFeedback = UIImpactFeedbackGenerator(style: .heavy)

    var body: some View {
        Button("Light Feedback") {
            lightFeedback.impactOccurred() // Use this line for haptic feedback
        }

        Button("Medium Feedback") {
            mediumFeedback.impactOccurred()
        }

        Button("Heavy Feedback") {
            heavyFeedback.impactOccurred()
        }
    }

}

Time to build your iOS App?

ShipiOS provides you SwiftUI boilerplate, How-to Guides, Components Library and extra rewards!

Get ShipiOS Package
ShipiOS.App

I told you it's more than just a boilerplate :)

Made with ❤️ on 🌍

Need help? Reach out on:

© Copyright 2024 ShipiOS.App - All rights reserved.