Skip to content

Commit 90790c3

Browse files
refactor: made minor updates (check description)
* Set constants for `EmojiCategory` (they were variables for no need) * Removed injecting dependency from initializer's default value
1 parent f3cee41 commit 90790c3

7 files changed

Lines changed: 53 additions & 14 deletions

File tree

EmojiPicker.xcodeproj/project.pbxproj

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
F0A434F42971A0C200663826 /* EmojiPickerViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434F32971A0C200663826 /* EmojiPickerViewModelTests.swift */; };
11+
F0A434F82971A0DC00663826 /* UnicodeManagerStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434F62971A0DB00663826 /* UnicodeManagerStub.swift */; };
12+
F0A434FA2971A3B900663826 /* ArrayExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434F92971A3B900663826 /* ArrayExtensionTests.swift */; };
13+
F0A434FC2971A67F00663826 /* UnicodeManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434FB2971A67F00663826 /* UnicodeManagerTests.swift */; };
14+
F0A434FE2971A69100663826 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434FD2971A69100663826 /* Observable.swift */; };
15+
F0A435002971A6A500663826 /* PickerArrowDirectionModeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434FF2971A6A500663826 /* PickerArrowDirectionModeTests.swift */; };
1016
F0BB7EC3297157D3004EEBFC /* EmojiPicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0BB7EBA297157D3004EEBFC /* EmojiPicker.framework */; };
1117
F0BB7EC8297157D3004EEBFC /* ConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0BB7EC7297157D3004EEBFC /* ConfigurationTests.swift */; };
1218
F0BB7ED629715831004EEBFC /* EmojiPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = F0BB7ED329715830004EEBFC /* EmojiPicker.h */; };
@@ -50,6 +56,12 @@
5056
/* End PBXContainerItemProxy section */
5157

5258
/* Begin PBXFileReference section */
59+
F0A434F32971A0C200663826 /* EmojiPickerViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPickerViewModelTests.swift; sourceTree = "<group>"; };
60+
F0A434F62971A0DB00663826 /* UnicodeManagerStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnicodeManagerStub.swift; sourceTree = "<group>"; };
61+
F0A434F92971A3B900663826 /* ArrayExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayExtensionTests.swift; sourceTree = "<group>"; };
62+
F0A434FB2971A67F00663826 /* UnicodeManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnicodeManagerTests.swift; sourceTree = "<group>"; };
63+
F0A434FD2971A69100663826 /* Observable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = "<group>"; };
64+
F0A434FF2971A6A500663826 /* PickerArrowDirectionModeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickerArrowDirectionModeTests.swift; sourceTree = "<group>"; };
5365
F0BB7EBA297157D3004EEBFC /* EmojiPicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EmojiPicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5466
F0BB7EC2297157D3004EEBFC /* EmojiPickerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EmojiPickerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
5567
F0BB7EC7297157D3004EEBFC /* ConfigurationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationTests.swift; sourceTree = "<group>"; };
@@ -108,6 +120,14 @@
108120
/* End PBXFrameworksBuildPhase section */
109121

110122
/* Begin PBXGroup section */
123+
F0A434F52971A0CE00663826 /* Stubs */ = {
124+
isa = PBXGroup;
125+
children = (
126+
F0A434F62971A0DB00663826 /* UnicodeManagerStub.swift */,
127+
);
128+
path = Stubs;
129+
sourceTree = "<group>";
130+
};
111131
F0BB7EB0297157D3004EEBFC = {
112132
isa = PBXGroup;
113133
children = (
@@ -133,8 +153,14 @@
133153
F0BB7EC6297157D3004EEBFC /* Tests */ = {
134154
isa = PBXGroup;
135155
children = (
136-
F0BB7F3629716AE9004EEBFC /* Mocks */,
137156
F0BB7EC7297157D3004EEBFC /* ConfigurationTests.swift */,
157+
F0A434F32971A0C200663826 /* EmojiPickerViewModelTests.swift */,
158+
F0A434FB2971A67F00663826 /* UnicodeManagerTests.swift */,
159+
F0A434FF2971A6A500663826 /* PickerArrowDirectionModeTests.swift */,
160+
F0A434F92971A3B900663826 /* ArrayExtensionTests.swift */,
161+
F0A434FD2971A69100663826 /* Observable.swift */,
162+
F0BB7F3629716AE9004EEBFC /* Mocks */,
163+
F0A434F52971A0CE00663826 /* Stubs */,
138164
);
139165
path = Tests;
140166
sourceTree = "<group>";
@@ -430,8 +456,14 @@
430456
isa = PBXSourcesBuildPhase;
431457
buildActionMask = 2147483647;
432458
files = (
459+
F0A435002971A6A500663826 /* PickerArrowDirectionModeTests.swift in Sources */,
433460
F0BB7EC8297157D3004EEBFC /* ConfigurationTests.swift in Sources */,
434461
F0BB7F3829716AFD004EEBFC /* EmojiPickerDelegateMock.swift in Sources */,
462+
F0A434F42971A0C200663826 /* EmojiPickerViewModelTests.swift in Sources */,
463+
F0A434FE2971A69100663826 /* Observable.swift in Sources */,
464+
F0A434FC2971A67F00663826 /* UnicodeManagerTests.swift in Sources */,
465+
F0A434FA2971A3B900663826 /* ArrayExtensionTests.swift in Sources */,
466+
F0A434F82971A0DC00663826 /* UnicodeManagerStub.swift in Sources */,
435467
);
436468
runOnlyForDeploymentPostprocessing = 0;
437469
};
@@ -600,6 +632,7 @@
600632
INFOPLIST_KEY_NSHumanReadableCopyright = "";
601633
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
602634
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
635+
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
603636
LD_RUNPATH_SEARCH_PATHS = (
604637
"$(inherited)",
605638
"@executable_path/Frameworks",
@@ -609,11 +642,11 @@
609642
PRODUCT_BUNDLE_IDENTIFIER = com.egbad.EmojiPicker;
610643
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
611644
SKIP_INSTALL = YES;
612-
SUPPORTS_MACCATALYST = NO;
645+
SUPPORTS_MACCATALYST = YES;
613646
SWIFT_EMIT_LOC_STRINGS = YES;
614647
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
615648
SWIFT_VERSION = 4.2;
616-
TARGETED_DEVICE_FAMILY = 1;
649+
TARGETED_DEVICE_FAMILY = "1,2";
617650
};
618651
name = Debug;
619652
};
@@ -633,6 +666,7 @@
633666
INFOPLIST_KEY_NSHumanReadableCopyright = "";
634667
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
635668
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
669+
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 14.2;
636670
LD_RUNPATH_SEARCH_PATHS = (
637671
"$(inherited)",
638672
"@executable_path/Frameworks",
@@ -642,10 +676,10 @@
642676
PRODUCT_BUNDLE_IDENTIFIER = com.egbad.EmojiPicker;
643677
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
644678
SKIP_INSTALL = YES;
645-
SUPPORTS_MACCATALYST = NO;
679+
SUPPORTS_MACCATALYST = YES;
646680
SWIFT_EMIT_LOC_STRINGS = YES;
647681
SWIFT_VERSION = 4.2;
648-
TARGETED_DEVICE_FAMILY = 1;
682+
TARGETED_DEVICE_FAMILY = "1,2";
649683
};
650684
name = Release;
651685
};

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.

Sources/EmojiPicker/Models/EmojiModel.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ enum EmojiCategoryType: Int {
3131
case flags
3232
}
3333

34-
/// Describes emoji categories
34+
/// Describes emoji categories.
3535
struct EmojiCategory {
36-
var categoryName: String
37-
var emojis: [[Int]]
36+
let categoryName: String
37+
let emojis: [[Int]]
3838
}

Sources/EmojiPicker/ViewModel/EmojiPickerViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ final class EmojiPickerViewModel: EmojiPickerViewModelProtocol {
4646
/// All emoji categories.
4747
private var emojiCategories = [EmojiCategory]()
4848

49-
init(unicodeManager: UnicodeManagerProtocol = UnicodeManager()) {
49+
init(unicodeManager: UnicodeManagerProtocol) {
5050
emojiCategories = unicodeManager.getEmojisForCurrentIOSVersion()
5151
}
5252

Sources/EmojiPicker/Views/EmojiPickerViewController.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,11 @@ public final class EmojiPickerViewController: UIViewController {
106106
horizontalInset = configuration.horizontalInset
107107
isDismissAfterChoosing = configuration.isDismissAfterChoosing
108108
customHeight = configuration.customHeight
109-
viewModel = EmojiPickerViewModel()
109+
110+
let unicodeManager = UnicodeManager()
111+
viewModel = EmojiPickerViewModel(unicodeManager: unicodeManager)
110112

111113
super.init(nibName: nil, bundle: nil)
112-
modalPresentationStyle = .popover
113114

114115
delegate = configuration.delegate
115116
sourceView = configuration.sender
@@ -122,13 +123,17 @@ public final class EmojiPickerViewController: UIViewController {
122123
fatalError("init(coder:) has not been implemented")
123124
}
124125

125-
// MARK: - Life cycle
126+
// MARK: - Life Cycle
127+
126128
override public func loadView() {
127129
view = emojiPickerView
128130
}
129131

130132
override public func viewDidLoad() {
131133
super.viewDidLoad()
134+
135+
modalPresentationStyle = .popover
136+
132137
setupPreferredContentSize()
133138
setupArrowDirections()
134139
setupHorizontalInset()

0 commit comments

Comments
 (0)