|
1 | 1 | // The MIT License (MIT) |
2 | | -// Copyright © 2022 Egor Badmaev |
| 2 | +// Copyright © 2022 Ivan Izyumkin |
3 | 3 | // |
4 | 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy |
5 | 5 | // of this software and associated documentation files (the "Software"), to deal |
@@ -76,21 +76,12 @@ final class EmojiPickerView: UIView { |
76 | 76 | return bounds.width * 0.13 |
77 | 77 | } |
78 | 78 |
|
79 | | - // MARK: - Init |
80 | | - |
81 | | - init() { |
82 | | - super.init(frame: .zero) |
83 | | - |
84 | | - setupCategoryViews() |
85 | | - } |
86 | | - |
87 | | - required init?(coder: NSCoder) { |
88 | | - fatalError("init(coder:) has not been implemented") |
89 | | - } |
| 79 | + // MARK: - Override |
90 | 80 |
|
91 | 81 | override func draw(_ rect: CGRect) { |
92 | 82 | super.draw(rect) |
93 | 83 |
|
| 84 | + setupCategoryViews() |
94 | 85 | setupView() |
95 | 86 | } |
96 | 87 |
|
@@ -137,14 +128,15 @@ final class EmojiPickerView: UIView { |
137 | 128 | categoryIndex: categoryIndex, |
138 | 129 | selectedEmojiCategoryTintColor: selectedEmojiCategoryTintColor |
139 | 130 | ) |
140 | | - // Installing selected state for first categoryView |
| 131 | + |
| 132 | + /// We need to set _selected_ state for the first category (default at the start). |
141 | 133 | categoryView.updateCategoryViewState(selectedCategoryIndex: 0) |
142 | 134 | categoryViews.append(categoryView) |
143 | 135 | categoriesStackView.addArrangedSubview(categoryView) |
144 | 136 | } |
145 | 137 | } |
146 | 138 |
|
147 | | - /// Scrolls collectionView to header for selected category. |
| 139 | + /// Scrolls collection view to the header of selected category. |
148 | 140 | /// |
149 | 141 | /// - Parameter section: Selected category index. |
150 | 142 | private func scrollToHeader(for section: Int) { |
|
0 commit comments