Skip to content

Instantly share code, notes, and snippets.

@KentarouKanno
Created December 18, 2016 02:33
Show Gist options
  • Save KentarouKanno/042ac2fecedae24781ab0a88fd98bf8a to your computer and use it in GitHub Desktop.
Save KentarouKanno/042ac2fecedae24781ab0a88fd98bf8a to your computer and use it in GitHub Desktop.
UIFeedbackGenerator

UIFeedbackGenerator

★ UINotificationFeedbackGenerator

let generator = UINotificationFeedbackGenerator()
generator.prepare()
generator.notificationOccurred(.error)


public enum UINotificationFeedbackType : Int {
    case success
    case warning
    case error
}

★ UIImpactFeedbackGenerator

let generator = UIImpactFeedbackGenerator(style: .light)
generator.prepare()
generator.impactOccurred()


public enum UIImpactFeedbackStyle : Int {
    case light
    case medium
    case heavy
}

★ UISelectionFeedbackGenerator

let generator = UISelectionFeedbackGenerator()
generator.prepare()
generator.selectionChanged()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment