update README
This commit is contained in:
BIN
.assets/EmojiPicker-1.png
Normal file
BIN
.assets/EmojiPicker-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 504 KiB |
BIN
.assets/EmojiPicker-2.png
Normal file
BIN
.assets/EmojiPicker-2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 312 KiB |
BIN
.assets/EmojiPicker-Vid.gif
Normal file
BIN
.assets/EmojiPicker-Vid.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 MiB |
BIN
.assets/EmojiPickerFront.png
Normal file
BIN
.assets/EmojiPickerFront.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 290 KiB |
9
EmojiPicker/.gitignore
vendored
9
EmojiPicker/.gitignore
vendored
@@ -1,9 +0,0 @@
|
|||||||
.DS_Store
|
|
||||||
/.build
|
|
||||||
/Packages
|
|
||||||
/*.xcodeproj
|
|
||||||
xcuserdata/
|
|
||||||
DerivedData/
|
|
||||||
.swiftpm/config/registries.json
|
|
||||||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
|
||||||
.netrc
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>IDEDidComputeMac32BitWarning</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# EmojiPicker
|
|
||||||
|
|
||||||
A description of this package.
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
//
|
|
||||||
// EmojiProvider.swift
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// Created by Kévin Sibué on 11/01/2023.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import Smile
|
|
||||||
|
|
||||||
public final class EmojiProvider {
|
|
||||||
|
|
||||||
func getAll() -> [Emoji] {
|
|
||||||
return Smile.list().map({ Emoji(value: $0, name: name(emoji: $0).first ?? "") })
|
|
||||||
//return emoticons + transportAndMap + regionalCountryFlags + miscItems + miscSymbols + miscSymbolsAndPictographs + supplementalSymbolsAndPictographs + dingbats + variationSelectors + variousAsianCharacters + diacriticalMarksAndSymbols + variationSelector
|
|
||||||
}
|
|
||||||
|
|
||||||
var emoticons: [String] {
|
|
||||||
return convert(0x1F601...0x1F64F)
|
|
||||||
}
|
|
||||||
|
|
||||||
var diacriticalMarksAndSymbols: [String] {
|
|
||||||
return convert(8400...8447)
|
|
||||||
}
|
|
||||||
|
|
||||||
var miscItems: [String] {
|
|
||||||
return convert(9100...9300)
|
|
||||||
}
|
|
||||||
|
|
||||||
var miscSymbols: [String] {
|
|
||||||
return convert(0x2600...0x26FF)
|
|
||||||
}
|
|
||||||
|
|
||||||
var dingbats: [String] {
|
|
||||||
return convert(0x2700...0x27BF)
|
|
||||||
}
|
|
||||||
|
|
||||||
var variationSelectors: [String] {
|
|
||||||
return convert(0xFE00...0xFE0F)
|
|
||||||
}
|
|
||||||
|
|
||||||
var variousAsianCharacters: [String] {
|
|
||||||
return convert(0x1F018...0x1F270)
|
|
||||||
}
|
|
||||||
|
|
||||||
var miscSymbolsAndPictographs: [String] {
|
|
||||||
return convert(0x1F300...0x1F5FF)
|
|
||||||
}
|
|
||||||
|
|
||||||
var transportAndMap: [String] {
|
|
||||||
return convert(0x1F680...0x1F6FF)
|
|
||||||
}
|
|
||||||
|
|
||||||
var regionalCountryFlags: [String] {
|
|
||||||
return convert(0x1F1E6...0x1F1FF)
|
|
||||||
}
|
|
||||||
|
|
||||||
var supplementalSymbolsAndPictographs: [String] {
|
|
||||||
return convert(0x1F900...0x1F9FF)
|
|
||||||
}
|
|
||||||
|
|
||||||
var variationSelector: [String] {
|
|
||||||
return convert(65024...65039)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func convert(_ range: ClosedRange<Int>) -> [String] {
|
|
||||||
return range.map({ String(UnicodeScalar($0) ?? " ") }).filter({ !$0.isEmpty })
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -7,20 +7,20 @@
|
|||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
|
B089F70829702B8400F0C479 /* EmojiPicker in Frameworks */ = {isa = PBXBuildFile; productRef = B089F70729702B8400F0C479 /* EmojiPicker */; };
|
||||||
B0DD3892296ED65900DEFE36 /* EmojiPickerSampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0DD3891296ED65900DEFE36 /* EmojiPickerSampleApp.swift */; };
|
B0DD3892296ED65900DEFE36 /* EmojiPickerSampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0DD3891296ED65900DEFE36 /* EmojiPickerSampleApp.swift */; };
|
||||||
B0DD3894296ED65900DEFE36 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0DD3893296ED65900DEFE36 /* ContentView.swift */; };
|
B0DD3894296ED65900DEFE36 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0DD3893296ED65900DEFE36 /* ContentView.swift */; };
|
||||||
B0DD3896296ED65B00DEFE36 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B0DD3895296ED65B00DEFE36 /* Assets.xcassets */; };
|
B0DD3896296ED65B00DEFE36 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B0DD3895296ED65B00DEFE36 /* Assets.xcassets */; };
|
||||||
B0DD3899296ED65B00DEFE36 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B0DD3898296ED65B00DEFE36 /* Preview Assets.xcassets */; };
|
B0DD3899296ED65B00DEFE36 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B0DD3898296ED65B00DEFE36 /* Preview Assets.xcassets */; };
|
||||||
B0DD38A3296ED75900DEFE36 /* EmojiPicker in Frameworks */ = {isa = PBXBuildFile; productRef = B0DD38A2296ED75900DEFE36 /* EmojiPicker */; };
|
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
B089F70629702B7E00F0C479 /* EmojiPicker */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = EmojiPicker; path = ..; sourceTree = "<group>"; };
|
||||||
B0DD388E296ED65900DEFE36 /* EmojiPickerSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EmojiPickerSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
B0DD388E296ED65900DEFE36 /* EmojiPickerSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EmojiPickerSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
B0DD3891296ED65900DEFE36 /* EmojiPickerSampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPickerSampleApp.swift; sourceTree = "<group>"; };
|
B0DD3891296ED65900DEFE36 /* EmojiPickerSampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPickerSampleApp.swift; sourceTree = "<group>"; };
|
||||||
B0DD3893296ED65900DEFE36 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
B0DD3893296ED65900DEFE36 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||||
B0DD3895296ED65B00DEFE36 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
B0DD3895296ED65B00DEFE36 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
B0DD3898296ED65B00DEFE36 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
B0DD3898296ED65B00DEFE36 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||||
B0DD38A0296ED67600DEFE36 /* EmojiPicker */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = EmojiPicker; path = ../EmojiPicker; sourceTree = "<group>"; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
B0DD38A3296ED75900DEFE36 /* EmojiPicker in Frameworks */,
|
B089F70829702B8400F0C479 /* EmojiPicker in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
B0DD3885296ED65900DEFE36 = {
|
B0DD3885296ED65900DEFE36 = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
B089F70629702B7E00F0C479 /* EmojiPicker */,
|
||||||
B0DD389F296ED67600DEFE36 /* Packages */,
|
B0DD389F296ED67600DEFE36 /* Packages */,
|
||||||
B0DD3890296ED65900DEFE36 /* EmojiPickerSample */,
|
B0DD3890296ED65900DEFE36 /* EmojiPickerSample */,
|
||||||
B0DD388F296ED65900DEFE36 /* Products */,
|
B0DD388F296ED65900DEFE36 /* Products */,
|
||||||
@@ -75,7 +76,6 @@
|
|||||||
B0DD389F296ED67600DEFE36 /* Packages */ = {
|
B0DD389F296ED67600DEFE36 /* Packages */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
B0DD38A0296ED67600DEFE36 /* EmojiPicker */,
|
|
||||||
);
|
);
|
||||||
name = Packages;
|
name = Packages;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
);
|
);
|
||||||
name = EmojiPickerSample;
|
name = EmojiPickerSample;
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
B0DD38A2296ED75900DEFE36 /* EmojiPicker */,
|
B089F70729702B8400F0C479 /* EmojiPicker */,
|
||||||
);
|
);
|
||||||
productName = EmojiPickerSample;
|
productName = EmojiPickerSample;
|
||||||
productReference = B0DD388E296ED65900DEFE36 /* EmojiPickerSample.app */;
|
productReference = B0DD388E296ED65900DEFE36 /* EmojiPickerSample.app */;
|
||||||
@@ -364,7 +364,7 @@
|
|||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
/* Begin XCSwiftPackageProductDependency section */
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
B0DD38A2296ED75900DEFE36 /* EmojiPicker */ = {
|
B089F70729702B8400F0C479 /* EmojiPicker */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = EmojiPicker;
|
productName = EmojiPicker;
|
||||||
};
|
};
|
||||||
|
|||||||
14
Package.resolved
Normal file
14
Package.resolved
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "smile",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/onmyway133/Smile",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "40604722a7a56f735124e069fcbb58307637744b",
|
||||||
|
"version" : "2.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version" : 2
|
||||||
|
}
|
||||||
114
README.md
Normal file
114
README.md
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|

|
||||||
|
|
||||||
|
## Goal
|
||||||
|
|
||||||
|
In some cases you need to be able to select an emoji and not allow a user to enter anything else (letters, numbers, symbols, ...).
|
||||||
|
|
||||||
|
The EmojiPicker is there for that.
|
||||||
|
|
||||||
|
It is a SwiftUI library that allows you to get a list of all the emojis present on your smartphone but also to create a selector to simplify your life.
|
||||||
|
|
||||||
|
## Screenshots and video
|
||||||
|
|
||||||
|
|Emoji list|Emoji search|
|
||||||
|
|---|---|
|
||||||
|
|||
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- SwiftUI (iOS >= 15.0)
|
||||||
|
- [Smile](https://github.com/onmyway133/Smile) (2.1.0)
|
||||||
|
|
||||||
|
## How install it?
|
||||||
|
|
||||||
|
Nowaday we only support Swift Package Manager. You can use build-in UI tool for XCode with this search words: `EmojiPicker` or you can add it directly with this following command :
|
||||||
|
|
||||||
|
```swift
|
||||||
|
.package(url: "https://github.com/Kelvas09/EmojiPicker.git", from: "1.0.0")
|
||||||
|
```
|
||||||
|
|
||||||
|
## How use it?
|
||||||
|
|
||||||
|
First of all you have to import the library `EmojiPicker`:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import EmojiPicker
|
||||||
|
```
|
||||||
|
|
||||||
|
You then have the option of using the `EmojiPickerView`. This view represents the list of selectable emojis.
|
||||||
|
|
||||||
|
The latter is not embedded in a NavigationView. If you want to display it with a title, you have to do it yourself:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
...
|
||||||
|
NavigationView {
|
||||||
|
EmojiPickerView(selectedEmoji: $selectedEmoji, selectedColor: .orange)
|
||||||
|
.navigationTitle("Emojis")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
}
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
Here is a complete example:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
import SwiftUI
|
||||||
|
import EmojiPicker
|
||||||
|
|
||||||
|
struct ContentView: View {
|
||||||
|
|
||||||
|
@State
|
||||||
|
var selectedEmoji: Emoji?
|
||||||
|
|
||||||
|
@State
|
||||||
|
var displayEmojiPicker: Bool = false
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
VStack {
|
||||||
|
VStack {
|
||||||
|
Text(selectedEmoji?.value ?? "")
|
||||||
|
.font(.largeTitle)
|
||||||
|
Text(selectedEmoji?.name ?? "")
|
||||||
|
.font(.title3)
|
||||||
|
}
|
||||||
|
.padding(8)
|
||||||
|
Button {
|
||||||
|
displayEmojiPicker = true
|
||||||
|
} label: {
|
||||||
|
Text("Select emoji")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
.sheet(isPresented: $displayEmojiPicker) {
|
||||||
|
NavigationView {
|
||||||
|
EmojiPickerView(selectedEmoji: $selectedEmoji, selectedColor: .orange)
|
||||||
|
.navigationTitle("Emojis")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Select color
|
||||||
|
|
||||||
|
When a user selects an emoji, it is highlighted. By default the selection color is `blue` but you can change this value when creating the view:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
EmojiPickerView(selectedEmoji: $selectedEmoji, selectedColor: .orange)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Enable search
|
||||||
|
|
||||||
|
By default the search for emoji is allowed in the picker, it is however possible to change this setting when creating the view:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
EmojiPickerView(selectedEmoji: $selectedEmoji, searchEnabled: false)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Samples
|
||||||
|
|
||||||
|
You can access to sample project on folder `EmojiPickerSample`
|
||||||
17
Sources/EmojiPicker/EmojiProvider.swift
Normal file
17
Sources/EmojiPicker/EmojiProvider.swift
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// EmojiProvider.swift
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Created by Kévin Sibué on 11/01/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import Smile
|
||||||
|
|
||||||
|
public final class EmojiProvider {
|
||||||
|
|
||||||
|
func getAll() -> [Emoji] {
|
||||||
|
return Smile.list().map({ Emoji(value: $0, name: name(emoji: $0).first ?? "") })
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user