@@ -74,7 +74,7 @@ public final class EmojiPickerViewController: UIViewController {
7474
7575 - Note: The default value of this property is `true`.
7676 */
77- let isDismissAfterChoosing : Bool
77+ let isDismissedAfterChoosing : Bool
7878
7979 /**
8080 Color for the selected emoji category.
@@ -93,20 +93,23 @@ public final class EmojiPickerViewController: UIViewController {
9393
9494 - Note: The default value of this property is `.light`.
9595 */
96- var feedBackGeneratorStyle : UIImpactFeedbackGenerator . FeedbackStyle ? {
96+ var feedbackGeneratorStyle : UIImpactFeedbackGenerator . FeedbackStyle ? {
9797 didSet {
98- guard let feedBackGeneratorStyle = feedBackGeneratorStyle else {
99- generator = nil
98+ guard let feedBackGeneratorStyle = feedbackGeneratorStyle else {
99+ feedbackGenerator = nil
100100 return
101101 }
102- generator = UIImpactFeedbackGenerator ( style: feedBackGeneratorStyle)
102+ feedbackGenerator = UIImpactFeedbackGenerator ( style: feedBackGeneratorStyle)
103103 }
104104 }
105105
106106 // MARK: - Private Properties
107107
108+ /// View of this controller.
108109 private let emojiPickerView = EmojiPickerView ( )
109- private var generator : UIImpactFeedbackGenerator ?
110+ /// An obect that creates haptics to simulate physical impacts.
111+ private var feedbackGenerator : UIImpactFeedbackGenerator ?
112+ /// View model of this module.
110113 private var viewModel : EmojiPickerViewModelProtocol
111114
112115 // MARK: - Init
@@ -116,8 +119,9 @@ public final class EmojiPickerViewController: UIViewController {
116119 arrowDirection = configuration. arrowDirection
117120 selectedEmojiCategoryTintColor = configuration. selectedEmojiCategoryTintColor
118121 horizontalInset = configuration. horizontalInset
119- isDismissAfterChoosing = configuration. isDismissAfterChoosing
122+ isDismissedAfterChoosing = configuration. isDismissAfterChoosing
120123 customHeight = configuration. customHeight
124+ feedbackGeneratorStyle = configuration. feedbackGeneratorStyle
121125
122126 let unicodeManager = UnicodeManager ( )
123127 viewModel = EmojiPickerViewModel ( unicodeManager: unicodeManager)
@@ -155,12 +159,14 @@ public final class EmojiPickerViewController: UIViewController {
155159
156160 private func bindViewModel( ) {
157161 viewModel. selectedEmoji. bind { [ unowned self] emoji in
158- generator ? . impactOccurred ( )
162+ feedbackGenerator ? . impactOccurred ( )
159163 delegate? . didGetEmoji ( emoji: emoji)
160- if isDismissAfterChoosing {
164+
165+ if isDismissedAfterChoosing {
161166 dismiss ( animated: true , completion: nil )
162167 }
163168 }
169+
164170 viewModel. selectedEmojiCategoryIndex. bind { [ unowned self] categoryIndex in
165171 self . emojiPickerView. updateSelectedCategoryIcon ( with: categoryIndex)
166172 }
@@ -288,7 +294,7 @@ extension EmojiPickerViewController: UICollectionViewDelegateFlowLayout {
288294extension EmojiPickerViewController : EmojiPickerViewDelegate {
289295
290296 func didChoiceEmojiCategory( at index: Int ) {
291- generator ? . impactOccurred ( )
297+ feedbackGenerator ? . impactOccurred ( )
292298 viewModel. selectedEmojiCategoryIndex. value = index
293299 }
294300}
0 commit comments