Skip to content

Commit 24f256b

Browse files
refactor: refuse to Configuration usage
1 parent 244e98d commit 24f256b

File tree

10 files changed

+17
-156
lines changed

10 files changed

+17
-156
lines changed

EmojiPicker.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'EmojiPicker'
3-
s.version = '2.1.3'
3+
s.version = '3.0.0'
44
s.license = 'MIT'
55
s.summary = 'Emoji picker for iOS like on MacOS'
66
s.homepage = 'https://github.com/htmlprogrammist/EmojiPicker'

EmojiPicker.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,13 @@
1717
F0A435002971A6A500663826 /* PickerArrowDirectionModeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434FF2971A6A500663826 /* PickerArrowDirectionModeTests.swift */; };
1818
F0A435022971A87500663826 /* EmojiCategoryTypeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A435012971A87500663826 /* EmojiCategoryTypeTests.swift */; };
1919
F0BB7EC3297157D3004EEBFC /* EmojiPicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0BB7EBA297157D3004EEBFC /* EmojiPicker.framework */; };
20-
F0BB7EC8297157D3004EEBFC /* ConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7EC7297157D3004EEBFC /* ConfigurationTests.swift */; };
2120
F0BB7ED629715831004EEBFC /* EmojiPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = F0BB7ED329715830004EEBFC /* EmojiPicker.h */; };
2221
F0BB7ED829715831004EEBFC /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = F0BB7ED529715830004EEBFC /* README.md */; };
2322
F0BB7EDB297158BD004EEBFC /* EmojiPicker.podspec in Resources */ = {isa = PBXBuildFile; fileRef = F0BB7ED9297158BC004EEBFC /* EmojiPicker.podspec */; };
2423
F0BB7F17297159A6004EEBFC /* EmojiPickerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7EF2297159A6004EEBFC /* EmojiPickerViewModel.swift */; };
2524
F0BB7F18297159A6004EEBFC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F0BB7EF5297159A6004EEBFC /* Localizable.strings */; };
2625
F0BB7F19297159A6004EEBFC /* EmojiModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7EF9297159A6004EEBFC /* EmojiModel.swift */; };
2726
F0BB7F1A297159A6004EEBFC /* PickerArrowDirectionMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7EFA297159A6004EEBFC /* PickerArrowDirectionMode.swift */; };
28-
F0BB7F1B297159A6004EEBFC /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7EFB297159A6004EEBFC /* Configuration.swift */; };
2927
F0BB7F1C297159A6004EEBFC /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7EFE297159A6004EEBFC /* UIView.swift */; };
3028
F0BB7F1D297159A6004EEBFC /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7EFF297159A6004EEBFC /* UIColor.swift */; };
3129
F0BB7F1E297159A6004EEBFC /* Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7F01297159A6004EEBFC /* Array.swift */; };
@@ -70,7 +68,6 @@
7068
F0A435012971A87500663826 /* EmojiCategoryTypeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCategoryTypeTests.swift; sourceTree = "<group>"; };
7169
F0BB7EBA297157D3004EEBFC /* EmojiPicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EmojiPicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7270
F0BB7EC2297157D3004EEBFC /* EmojiPickerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EmojiPickerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
73-
F0BB7EC7297157D3004EEBFC /* ConfigurationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationTests.swift; sourceTree = "<group>"; };
7471
F0BB7ED329715830004EEBFC /* EmojiPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EmojiPicker.h; sourceTree = "<group>"; };
7572
F0BB7ED429715830004EEBFC /* Package.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
7673
F0BB7ED529715830004EEBFC /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
@@ -80,7 +77,6 @@
8077
F0BB7EF7297159A6004EEBFC /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
8178
F0BB7EF9297159A6004EEBFC /* EmojiModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmojiModel.swift; sourceTree = "<group>"; };
8279
F0BB7EFA297159A6004EEBFC /* PickerArrowDirectionMode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PickerArrowDirectionMode.swift; sourceTree = "<group>"; };
83-
F0BB7EFB297159A6004EEBFC /* Configuration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = "<group>"; };
8480
F0BB7EFE297159A6004EEBFC /* UIView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = "<group>"; };
8581
F0BB7EFF297159A6004EEBFC /* UIColor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = "<group>"; };
8682
F0BB7F01297159A6004EEBFC /* Array.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Array.swift; sourceTree = "<group>"; };
@@ -161,7 +157,6 @@
161157
F0BB7EC6297157D3004EEBFC /* Tests */ = {
162158
isa = PBXGroup;
163159
children = (
164-
F0BB7EC7297157D3004EEBFC /* ConfigurationTests.swift */,
165160
F0A434F32971A0C200663826 /* EmojiPickerViewModelTests.swift */,
166161
F0A435012971A87500663826 /* EmojiCategoryTypeTests.swift */,
167162
F0A434FB2971A67F00663826 /* UnicodeManagerTests.swift */,
@@ -224,7 +219,6 @@
224219
F0BB7EF8297159A6004EEBFC /* Models */ = {
225220
isa = PBXGroup;
226221
children = (
227-
F0BB7EFB297159A6004EEBFC /* Configuration.swift */,
228222
F0BB7EF9297159A6004EEBFC /* EmojiModel.swift */,
229223
F0BB7EFA297159A6004EEBFC /* PickerArrowDirectionMode.swift */,
230224
);
@@ -457,7 +451,6 @@
457451
F0BB7F1E297159A6004EEBFC /* Array.swift in Sources */,
458452
F0BB7F1A297159A6004EEBFC /* PickerArrowDirectionMode.swift in Sources */,
459453
F0BB7F19297159A6004EEBFC /* EmojiModel.swift in Sources */,
460-
F0BB7F1B297159A6004EEBFC /* Configuration.swift in Sources */,
461454
F0BB7F2D297159A6004EEBFC /* UnicodeManager.swift in Sources */,
462455
F0BB7F17297159A6004EEBFC /* EmojiPickerViewModel.swift in Sources */,
463456
F0BB7F29297159A6004EEBFC /* Unicode 14.swift in Sources */,
@@ -469,7 +462,6 @@
469462
buildActionMask = 2147483647;
470463
files = (
471464
F0A435002971A6A500663826 /* PickerArrowDirectionModeTests.swift in Sources */,
472-
F0BB7EC8297157D3004EEBFC /* ConfigurationTests.swift in Sources */,
473465
F0BB7F3829716AFD004EEBFC /* EmojiPickerDelegateMock.swift in Sources */,
474466
F0A435022971A87500663826 /* EmojiCategoryTypeTests.swift in Sources */,
475467
F0A434F42971A0C200663826 /* EmojiPickerViewModelTests.swift in Sources */,

Example App/AppImport/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
targets: ["AppImport"]),
1212
],
1313
dependencies: [
14-
.package(url: "https://github.com/htmlprogrammist/EmojiPicker", .upToNextMajor(from: "2.1.3"))
14+
.package(url: "https://github.com/htmlprogrammist/EmojiPicker", .upToNextMajor(from: "3.0.0"))
1515
],
1616
targets: [
1717
.target(

Example App/iOS Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example App/iOS Example/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ class ViewController: UIViewController {
2626
}
2727

2828
@objc private func openEmojiPickerModule(sender: UIButton) {
29-
let configuration = Configuration(delegate: self, sender: sender)
30-
let viewController = EmojiPickerViewController(configuration: configuration)
29+
let viewController = EmojiPickerViewController()
30+
viewController.delegate = self
3131
viewController.sourceView = sender
3232
present(viewController, animated: true)
3333
}

Sources/EmojiPicker/Models/Configuration.swift

Lines changed: 0 additions & 62 deletions
This file was deleted.

Sources/EmojiPicker/Views/EmojiPickerViewController.swift

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ public protocol EmojiPickerDelegate: AnyObject {
3232
/// Emoji Picker view controller.
3333
public final class EmojiPickerViewController: UIViewController {
3434

35-
// MARK: - Internal Properties
35+
// MARK: - Public Properties
3636

3737
/// Delegate for selecting an emoji object.
38-
weak var delegate: EmojiPickerDelegate?
38+
public weak var delegate: EmojiPickerDelegate?
3939

4040
/// The view containing the anchor rectangle for the popover.
41-
var sourceView: UIView? {
41+
public var sourceView: UIView? {
4242
didSet {
4343
popoverPresentationController?.sourceView = sourceView
4444
}
@@ -49,22 +49,22 @@ public final class EmojiPickerViewController: UIViewController {
4949

5050
- Note: The default value of this property is `.up`.
5151
*/
52-
let arrowDirection: PickerArrowDirectionMode
52+
public var arrowDirection: PickerArrowDirectionMode = .up
5353

5454
/**
5555
Custom height for EmojiPicker.
5656

5757
- Note: The default value of this property is `nil`.
5858
- Important: it will be limited by the distance from `sourceView.origin.y` to the upper or lower bound(depends on `permittedArrowDirections`).
5959
*/
60-
let customHeight: CGFloat?
60+
public var customHeight: CGFloat?
6161

6262
/**
6363
Inset from the sourceView border.
6464

6565
- Note: The default value of this property is `0`.
6666
*/
67-
let horizontalInset: CGFloat
67+
public var horizontalInset: CGFloat = 0
6868

6969
/**
7070
A boolean value that determines whether the screen will be hidden after the emoji is selected.
@@ -74,14 +74,14 @@ public final class EmojiPickerViewController: UIViewController {
7474

7575
- Note: The default value of this property is `true`.
7676
*/
77-
let isDismissedAfterChoosing: Bool
77+
public var isDismissedAfterChoosing: Bool = true
7878

7979
/**
8080
Color for the selected emoji category.
8181

8282
- Note: The default value of this property is `.systemBlue`.
8383
*/
84-
var selectedEmojiCategoryTintColor: UIColor? {
84+
public var selectedEmojiCategoryTintColor: UIColor? = .systemBlue {
8585
didSet {
8686
guard let selectedEmojiCategoryTintColor = selectedEmojiCategoryTintColor else { return }
8787
emojiPickerView.selectedEmojiCategoryTintColor = selectedEmojiCategoryTintColor
@@ -93,7 +93,7 @@ public final class EmojiPickerViewController: UIViewController {
9393

9494
- Note: The default value of this property is `.light`.
9595
*/
96-
var feedbackGeneratorStyle: UIImpactFeedbackGenerator.FeedbackStyle? {
96+
public var feedbackGeneratorStyle: UIImpactFeedbackGenerator.FeedbackStyle? {
9797
didSet {
9898
guard let feedBackGeneratorStyle = feedbackGeneratorStyle else {
9999
feedbackGenerator = nil
@@ -115,21 +115,12 @@ public final class EmojiPickerViewController: UIViewController {
115115
// MARK: - Init
116116

117117
/// Creates EmojiPicker view controller with provided configuration.
118-
public init(configuration: Configuration) {
119-
arrowDirection = configuration.arrowDirection
120-
selectedEmojiCategoryTintColor = configuration.selectedEmojiCategoryTintColor
121-
horizontalInset = configuration.horizontalInset
122-
isDismissedAfterChoosing = configuration.isDismissedAfterChoosing
123-
customHeight = configuration.customHeight
124-
feedbackGeneratorStyle = configuration.feedbackGeneratorStyle
125-
118+
public init() {
126119
let unicodeManager = UnicodeManager()
127120
viewModel = EmojiPickerViewModel(unicodeManager: unicodeManager)
128121

129122
super.init(nibName: nil, bundle: nil)
130-
131-
delegate = configuration.delegate
132-
sourceView = configuration.sender
123+
modalPresentationStyle = .popover
133124

134125
setupDelegates()
135126
bindViewModel()
@@ -148,8 +139,6 @@ public final class EmojiPickerViewController: UIViewController {
148139
override public func viewDidLoad() {
149140
super.viewDidLoad()
150141

151-
modalPresentationStyle = .popover
152-
153142
setupPreferredContentSize()
154143
setupArrowDirections()
155144
setupHorizontalInset()

Tests/ConfigurationTests.swift

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)