Skip to content

Commit 7da3d4c

Browse files
feat: completed unit-tests (check description)
* Unicode Manager * Observable
1 parent e5ba983 commit 7da3d4c

16 files changed

Lines changed: 240 additions & 52 deletions

File tree

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.0.1'
3+
s.version = '2.1.1'
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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
F0A434F82971A0DC00663826 /* UnicodeManagerStub.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434F62971A0DB00663826 /* UnicodeManagerStub.swift */; };
1212
F0A434FA2971A3B900663826 /* ArrayExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434F92971A3B900663826 /* ArrayExtensionTests.swift */; };
1313
F0A434FC2971A67F00663826 /* UnicodeManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434FB2971A67F00663826 /* UnicodeManagerTests.swift */; };
14-
F0A434FE2971A69100663826 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434FD2971A69100663826 /* Observable.swift */; };
14+
F0A434FE2971A69100663826 /* ObservableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434FD2971A69100663826 /* ObservableTests.swift */; };
1515
F0A435002971A6A500663826 /* PickerArrowDirectionModeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A434FF2971A6A500663826 /* PickerArrowDirectionModeTests.swift */; };
1616
F0A435022971A87500663826 /* EmojiCategoryTypeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A435012971A87500663826 /* EmojiCategoryTypeTests.swift */; };
1717
F0BB7EC3297157D3004EEBFC /* EmojiPicker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0BB7EBA297157D3004EEBFC /* EmojiPicker.framework */; };
@@ -61,7 +61,7 @@
6161
F0A434F62971A0DB00663826 /* UnicodeManagerStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnicodeManagerStub.swift; sourceTree = "<group>"; };
6262
F0A434F92971A3B900663826 /* ArrayExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayExtensionTests.swift; sourceTree = "<group>"; };
6363
F0A434FB2971A67F00663826 /* UnicodeManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnicodeManagerTests.swift; sourceTree = "<group>"; };
64-
F0A434FD2971A69100663826 /* Observable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = "<group>"; };
64+
F0A434FD2971A69100663826 /* ObservableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservableTests.swift; sourceTree = "<group>"; };
6565
F0A434FF2971A6A500663826 /* PickerArrowDirectionModeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PickerArrowDirectionModeTests.swift; sourceTree = "<group>"; };
6666
F0A435012971A87500663826 /* EmojiCategoryTypeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiCategoryTypeTests.swift; sourceTree = "<group>"; };
6767
F0BB7EBA297157D3004EEBFC /* EmojiPicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EmojiPicker.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -161,7 +161,7 @@
161161
F0A434FB2971A67F00663826 /* UnicodeManagerTests.swift */,
162162
F0A434FF2971A6A500663826 /* PickerArrowDirectionModeTests.swift */,
163163
F0A434F92971A3B900663826 /* ArrayExtensionTests.swift */,
164-
F0A434FD2971A69100663826 /* Observable.swift */,
164+
F0A434FD2971A69100663826 /* ObservableTests.swift */,
165165
F0BB7F3629716AE9004EEBFC /* Mocks */,
166166
F0A434F52971A0CE00663826 /* Stubs */,
167167
);
@@ -464,7 +464,7 @@
464464
F0BB7F3829716AFD004EEBFC /* EmojiPickerDelegateMock.swift in Sources */,
465465
F0A435022971A87500663826 /* EmojiCategoryTypeTests.swift in Sources */,
466466
F0A434F42971A0C200663826 /* EmojiPickerViewModelTests.swift in Sources */,
467-
F0A434FE2971A69100663826 /* Observable.swift in Sources */,
467+
F0A434FE2971A69100663826 /* ObservableTests.swift in Sources */,
468468
F0A434FC2971A67F00663826 /* UnicodeManagerTests.swift in Sources */,
469469
F0A434FA2971A3B900663826 /* ArrayExtensionTests.swift in Sources */,
470470
F0A434F82971A0DC00663826 /* UnicodeManagerStub.swift in Sources */,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>classNames</key>
6+
<dict>
7+
<key>UnicodeManagerTests</key>
8+
<dict>
9+
<key>testPerfomanceGettingEmojisForCurrentIOSVersion()</key>
10+
<dict>
11+
<key>com.apple.XCTPerformanceMetric_WallClockTime</key>
12+
<dict>
13+
<key>baselineAverage</key>
14+
<real>0.001147</real>
15+
<key>baselineIntegrationDisplayName</key>
16+
<string>Local Baseline</string>
17+
</dict>
18+
</dict>
19+
</dict>
20+
</dict>
21+
</dict>
22+
</plist>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>runDestinationsByUUID</key>
6+
<dict>
7+
<key>15BC5C40-36B2-4CD2-83A1-BFFC0C063699</key>
8+
<dict>
9+
<key>localComputer</key>
10+
<dict>
11+
<key>busSpeedInMHz</key>
12+
<integer>400</integer>
13+
<key>cpuCount</key>
14+
<integer>1</integer>
15+
<key>cpuKind</key>
16+
<string>Quad-Core Intel Core i5</string>
17+
<key>cpuSpeedInMHz</key>
18+
<integer>1100</integer>
19+
<key>logicalCPUCoresPerPackage</key>
20+
<integer>8</integer>
21+
<key>modelCode</key>
22+
<string>MacBookAir9,1</string>
23+
<key>physicalCPUCoresPerPackage</key>
24+
<integer>4</integer>
25+
<key>platformIdentifier</key>
26+
<string>com.apple.platform.macosx</string>
27+
</dict>
28+
<key>targetArchitecture</key>
29+
<string>x86_64</string>
30+
<key>targetDevice</key>
31+
<dict>
32+
<key>modelCode</key>
33+
<string>iPhone14,5</string>
34+
<key>platformIdentifier</key>
35+
<string>com.apple.platform.iphonesimulator</string>
36+
</dict>
37+
</dict>
38+
</dict>
39+
</dict>
40+
</plist>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1340"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "F0BB7EB9297157D3004EEBFC"
18+
BuildableName = "EmojiPicker.framework"
19+
BlueprintName = "EmojiPicker"
20+
ReferencedContainer = "container:EmojiPicker.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
language = "en"
31+
codeCoverageEnabled = "YES">
32+
<Testables>
33+
<TestableReference
34+
skipped = "NO">
35+
<BuildableReference
36+
BuildableIdentifier = "primary"
37+
BlueprintIdentifier = "F0BB7EC1297157D3004EEBFC"
38+
BuildableName = "EmojiPickerTests.xctest"
39+
BlueprintName = "EmojiPickerTests"
40+
ReferencedContainer = "container:EmojiPicker.xcodeproj">
41+
</BuildableReference>
42+
</TestableReference>
43+
</Testables>
44+
</TestAction>
45+
<LaunchAction
46+
buildConfiguration = "Debug"
47+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
48+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
49+
launchStyle = "0"
50+
useCustomWorkingDirectory = "NO"
51+
ignoresPersistentStateOnLaunch = "NO"
52+
debugDocumentVersioning = "YES"
53+
debugServiceExtension = "internal"
54+
allowLocationSimulation = "YES">
55+
</LaunchAction>
56+
<ProfileAction
57+
buildConfiguration = "Release"
58+
shouldUseLaunchSchemeArgsEnv = "YES"
59+
savedToolIdentifier = ""
60+
useCustomWorkingDirectory = "NO"
61+
debugDocumentVersioning = "YES">
62+
<MacroExpansion>
63+
<BuildableReference
64+
BuildableIdentifier = "primary"
65+
BlueprintIdentifier = "F0BB7EB9297157D3004EEBFC"
66+
BuildableName = "EmojiPicker.framework"
67+
BlueprintName = "EmojiPicker"
68+
ReferencedContainer = "container:EmojiPicker.xcodeproj">
69+
</BuildableReference>
70+
</MacroExpansion>
71+
</ProfileAction>
72+
<AnalyzeAction
73+
buildConfiguration = "Debug">
74+
</AnalyzeAction>
75+
<ArchiveAction
76+
buildConfiguration = "Release"
77+
revealArchiveInOrganizer = "YES">
78+
</ArchiveAction>
79+
</Scheme>

EmojiPicker.xcodeproj/xcuserdata/egbad.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,18 @@
1010
<integer>0</integer>
1111
</dict>
1212
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>F0BB7EB9297157D3004EEBFC</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>F0BB7EC1297157D3004EEBFC</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
</dict>
1326
</dict>
1427
</plist>

Example App/iOS Example/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@
7070
"scale" : "2x",
7171
"size" : "40x40"
7272
},
73+
{
74+
"idiom" : "ipad",
75+
"scale" : "1x",
76+
"size" : "76x76"
77+
},
7378
{
7479
"idiom" : "ipad",
7580
"scale" : "2x",

Sources/EmojiPicker/Extensions/UIKit/UIColor.swift

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,37 @@
2222
import UIKit
2323

2424
extension UIColor {
25-
/// Color for EmojiPicker background - `.systemGroupedBackground`.
25+
/// Color for EmojiPicker background - `.systemGroupedBackground` in UIKit.
2626
static let popoverBackgroundColor = UIColor(
2727
light: UIColor(red: 0.95, green: 0.95, blue: 0.97, alpha: 1.0),
2828
dark: UIColor(red: 0.11, green: 0.11, blue: 0.12, alpha: 1.0)
2929
)
3030

31-
/// Color for selectedBackgroundView background in EmojiCollectionViewCell - `.opaqueSeparator`.
31+
/// Color for `selectedBackgroundView` background in `EmojiCollectionViewCell` - `.opaqueSeparator` in UIKit.
3232
static let selectedCellBackgroundViewColor = UIColor(
3333
light: UIColor(red: 0.78, green: 0.78, blue: 0.8, alpha: 1.0),
3434
dark: UIColor(red: 0.28, green: 0.28, blue: 0.29, alpha: 1.0)
3535
)
3636

37-
/// Color for selectedBackgroundView background in EmojiCollectionViewCell - `.systemGray3`.
37+
/// Color for `separatorView` background in `EmojiPickerView` - `.systemGray3` in UIKit.
3838
static let separatorColor = UIColor(
3939
light: UIColor(red: 0.78, green: 0.78, blue: 0.78, alpha: 1.0),
4040
dark: UIColor(red: 0.22, green: 0.22, blue: 0.23, alpha: 1.0)
4141
)
4242

4343
/// Increases brightness or decreases saturation.
4444
func adjust(by percentage: CGFloat = 30.0) -> UIColor {
45-
var h: CGFloat = 0, s: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0
45+
var h: CGFloat = 0
46+
var s: CGFloat = 0
47+
var b: CGFloat = 0
48+
var a: CGFloat = 0
49+
4650
if self.getHue(&h, saturation: &s, brightness: &b, alpha: &a) {
4751
if b < 1.0 {
48-
let newB: CGFloat = max(min(b + (percentage/100.0)*b, 1.0), 0.0)
52+
let newB: CGFloat = max(min(b + (percentage/100.0) * b, 1.0), 0.0)
4953
return UIColor(hue: h, saturation: s, brightness: newB, alpha: a)
5054
} else {
51-
let newS: CGFloat = min(max(s - (percentage/100.0)*s, 0.0), 1.0)
55+
let newS: CGFloat = min(max(s - (percentage/100.0) * s, 0.0), 1.0)
5256
return UIColor(hue: h, saturation: newS, brightness: b, alpha: a)
5357
}
5458
}
@@ -57,11 +61,11 @@ extension UIColor {
5761
}
5862

5963
extension UIColor {
60-
/// Support for dark and light color versions.
64+
/// Supports light and dark color versions.
6165
convenience init(light: UIColor, dark: UIColor) {
6266
if #available(iOS 13.0, *) {
6367
self.init(dynamicProvider: { trait in
64-
trait.userInterfaceStyle == .dark ? dark : light
68+
trait.userInterfaceStyle == .light ? light : dark
6569
})
6670
} else {
6771
self.init(cgColor: light.cgColor)

0 commit comments

Comments
 (0)