Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Haptic Feedback : Enhance User Experience #24

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions CircleBar/Classes/SHCircleBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ import UIKit
customInit()
}

@IBInspectable var HapticFeedback:Bool = false {
perteadrian marked this conversation as resolved.
Show resolved Hide resolved
didSet{
self.hapticFeedback(status: HapticFeedback)
}
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
customInit()
Expand Down Expand Up @@ -83,8 +89,12 @@ import UIKit
bezPath.append(UIBezierPath(rect: self.bounds))
return bezPath
}
func hapticFeedback(){
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.success)

func hapticFeedback(status: Bool){
perteadrian marked this conversation as resolved.
Show resolved Hide resolved
if status == true {
perteadrian marked this conversation as resolved.
Show resolved Hide resolved
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.success)
print("hello")
}else{ }
perteadrian marked this conversation as resolved.
Show resolved Hide resolved
}
}
2 changes: 1 addition & 1 deletion CircleBar/Classes/SHCircleBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SHCircleBarController: UITabBarController {
}
guard let tabBar = tabBar as? SHCircleBar, let index = viewControllers?.index(of: newValue) else {return}
tabBar.select(itemAt: index, animated: true)
tabBar.hapticFeedback()
tabBar.hapticFeedback(status: tabBar.HapticFeedback)
perteadrian marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down