Switch from Smile to EmojiKit

This commit is contained in:
2024-06-05 23:25:54 -04:00
parent cf2bf1f5b8
commit 9063d4f72b
6 changed files with 21 additions and 30 deletions

View File

@@ -1,12 +1,21 @@
{
"pins" : [
{
"identity" : "smile",
"identity" : "emojikit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tyiu/Smile",
"location" : "https://github.com/tyiu/EmojiKit",
"state" : {
"branch" : "master",
"revision" : "70b703eeaeab93365e01944daba1a56e446852c7"
"branch" : "emoji-keywords",
"revision" : "3250b3cada8829ec3ff09013e861cba2b48bdb04"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
}
}
],

View File

@@ -15,14 +15,14 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/tyiu/Smile", branch: "master")
.package(url: "https://github.com/tyiu/EmojiKit", branch: "emoji-keywords")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "EmojiPicker",
dependencies: ["Smile"]),
dependencies: ["EmojiKit"]),
.testTarget(
name: "EmojiPickerTests",
dependencies: ["EmojiPicker"]),

View File

@@ -6,14 +6,14 @@
//
import Foundation
import Smile
import EmojiKit
public final class DefaultEmojiProvider: EmojiProvider {
public init() { }
public func getAll() -> [Emoji] {
return emojiList.values.map { Emoji(value: $0, name: name(emoji: $0).first ?? "") }
return EmojiManager.getAvailableEmojis().flatMap { $0.emojis.values }
}
}

View File

@@ -1,20 +0,0 @@
//
// Emoji.swift
//
//
// Created by Kévin Sibué on 11/01/2023.
//
import Foundation
public struct Emoji: Hashable {
public let value: String
public let name: String
public init(value: String, name: String) {
self.value = value
self.name = name
}
}

View File

@@ -6,6 +6,7 @@
//
import SwiftUI
import EmojiKit
public struct EmojiPickerView: View {
@@ -39,7 +40,7 @@ public struct EmojiPickerView: View {
return emojis
} else {
return emojis
.filter { $0.name.lowercased().contains(search.lowercased()) }
// .filter { $0.name.lowercased().contains(search.lowercased()) }
}
}
@@ -72,6 +73,6 @@ public struct EmojiPickerView: View {
struct EmojiPickerView_Previews: PreviewProvider {
static var previews: some View {
EmojiPickerView(selectedEmoji: .constant(Emoji(value: "", name: "")))
EmojiPickerView(selectedEmoji: .constant(Emoji(value: "", keywords: [])))
}
}

View File

@@ -6,6 +6,7 @@
//
import Foundation
import EmojiKit
public protocol EmojiProvider {
func getAll() -> [Emoji]