first version
This commit is contained in:
9
EmojiPicker/.gitignore
vendored
Normal file
9
EmojiPicker/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
.DS_Store
|
||||
/.build
|
||||
/Packages
|
||||
/*.xcodeproj
|
||||
xcuserdata/
|
||||
DerivedData/
|
||||
.swiftpm/config/registries.json
|
||||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
|
||||
.netrc
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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>
|
||||
30
EmojiPicker/Package.swift
Normal file
30
EmojiPicker/Package.swift
Normal file
@@ -0,0 +1,30 @@
|
||||
// swift-tools-version: 5.7
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "EmojiPicker",
|
||||
platforms: [.iOS(.v15)],
|
||||
products: [
|
||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||
.library(
|
||||
name: "EmojiPicker",
|
||||
targets: ["EmojiPicker"]),
|
||||
],
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
// .package(url: /* package url */, from: "1.0.0"),
|
||||
.package(url: "https://github.com/onmyway133/Smile", from: "2.1.0")
|
||||
],
|
||||
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"]),
|
||||
.testTarget(
|
||||
name: "EmojiPickerTests",
|
||||
dependencies: ["EmojiPicker"]),
|
||||
]
|
||||
)
|
||||
3
EmojiPicker/README.md
Normal file
3
EmojiPicker/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# EmojiPicker
|
||||
|
||||
A description of this package.
|
||||
20
EmojiPicker/Sources/EmojiPicker/Emoji.swift
Normal file
20
EmojiPicker/Sources/EmojiPicker/Emoji.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// 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
|
||||
}
|
||||
|
||||
}
|
||||
74
EmojiPicker/Sources/EmojiPicker/EmojiPickerView.swift
Normal file
74
EmojiPicker/Sources/EmojiPicker/EmojiPickerView.swift
Normal file
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// EmojiPickerView.swift
|
||||
//
|
||||
//
|
||||
// Created by Kévin Sibué on 11/01/2023.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
public struct EmojiPickerView: View {
|
||||
|
||||
@Environment(\.dismiss)
|
||||
var dismiss
|
||||
|
||||
@Binding
|
||||
public var selectedEmoji: Emoji?
|
||||
|
||||
@State
|
||||
private var search: String = ""
|
||||
|
||||
private var selectedColor: Color
|
||||
private var searchEnabled: Bool
|
||||
|
||||
public init(selectedEmoji: Binding<Emoji?>, searchEnabled: Bool = false, selectedColor: Color = .blue) {
|
||||
self._selectedEmoji = selectedEmoji
|
||||
self.selectedColor = selectedColor
|
||||
self.searchEnabled = searchEnabled
|
||||
}
|
||||
|
||||
let columns = [
|
||||
GridItem(.adaptive(minimum: 80))
|
||||
]
|
||||
|
||||
let emojis = EmojiProvider().getAll()
|
||||
|
||||
private var searchResults: [Emoji] {
|
||||
if search.isEmpty {
|
||||
return emojis
|
||||
} else {
|
||||
return emojis
|
||||
.filter { $0.name.lowercased().contains(search.lowercased()) }
|
||||
}
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
ScrollView {
|
||||
LazyVGrid(columns: columns, spacing: 20) {
|
||||
ForEach(searchResults, id: \.self) { emoji in
|
||||
RoundedRectangle(cornerRadius: 16)
|
||||
.fill((selectedEmoji == emoji ? selectedColor : Color.gray).opacity(0.4))
|
||||
.frame(width: 64, height: 64)
|
||||
.overlay {
|
||||
Text(emoji.value)
|
||||
.font(.largeTitle)
|
||||
}
|
||||
.onTapGesture {
|
||||
selectedEmoji = emoji
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
.frame(maxHeight: .infinity)
|
||||
.searchable(text: $search)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct EmojiPickerView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
EmojiPickerView(selectedEmoji: .constant(Emoji(value: "", name: "")))
|
||||
}
|
||||
}
|
||||
70
EmojiPicker/Sources/EmojiPicker/EmojiProvider.swift
Normal file
70
EmojiPicker/Sources/EmojiPicker/EmojiProvider.swift
Normal file
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// 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 })
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import XCTest
|
||||
@testable import EmojiPicker
|
||||
|
||||
final class EmojiPickerTests: XCTestCase {
|
||||
|
||||
}
|
||||
374
EmojiPickerSample/EmojiPickerSample.xcodeproj/project.pbxproj
Normal file
374
EmojiPickerSample/EmojiPickerSample.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,374 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 56;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
B0DD3892296ED65900DEFE36 /* EmojiPickerSampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0DD3891296ED65900DEFE36 /* EmojiPickerSampleApp.swift */; };
|
||||
B0DD3894296ED65900DEFE36 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0DD3893296ED65900DEFE36 /* ContentView.swift */; };
|
||||
B0DD3896296ED65B00DEFE36 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B0DD3895296ED65B00DEFE36 /* 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 */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
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>"; };
|
||||
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>"; };
|
||||
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 */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
B0DD388B296ED65900DEFE36 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B0DD38A3296ED75900DEFE36 /* EmojiPicker in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
B0DD3885296ED65900DEFE36 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B0DD389F296ED67600DEFE36 /* Packages */,
|
||||
B0DD3890296ED65900DEFE36 /* EmojiPickerSample */,
|
||||
B0DD388F296ED65900DEFE36 /* Products */,
|
||||
B0DD38A1296ED75900DEFE36 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B0DD388F296ED65900DEFE36 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B0DD388E296ED65900DEFE36 /* EmojiPickerSample.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B0DD3890296ED65900DEFE36 /* EmojiPickerSample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B0DD3891296ED65900DEFE36 /* EmojiPickerSampleApp.swift */,
|
||||
B0DD3893296ED65900DEFE36 /* ContentView.swift */,
|
||||
B0DD3895296ED65B00DEFE36 /* Assets.xcassets */,
|
||||
B0DD3897296ED65B00DEFE36 /* Preview Content */,
|
||||
);
|
||||
path = EmojiPickerSample;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B0DD3897296ED65B00DEFE36 /* Preview Content */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B0DD3898296ED65B00DEFE36 /* Preview Assets.xcassets */,
|
||||
);
|
||||
path = "Preview Content";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B0DD389F296ED67600DEFE36 /* Packages */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B0DD38A0296ED67600DEFE36 /* EmojiPicker */,
|
||||
);
|
||||
name = Packages;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
B0DD38A1296ED75900DEFE36 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
B0DD388D296ED65900DEFE36 /* EmojiPickerSample */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = B0DD389C296ED65B00DEFE36 /* Build configuration list for PBXNativeTarget "EmojiPickerSample" */;
|
||||
buildPhases = (
|
||||
B0DD388A296ED65900DEFE36 /* Sources */,
|
||||
B0DD388B296ED65900DEFE36 /* Frameworks */,
|
||||
B0DD388C296ED65900DEFE36 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = EmojiPickerSample;
|
||||
packageProductDependencies = (
|
||||
B0DD38A2296ED75900DEFE36 /* EmojiPicker */,
|
||||
);
|
||||
productName = EmojiPickerSample;
|
||||
productReference = B0DD388E296ED65900DEFE36 /* EmojiPickerSample.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
B0DD3886296ED65900DEFE36 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1420;
|
||||
LastUpgradeCheck = 1420;
|
||||
TargetAttributes = {
|
||||
B0DD388D296ED65900DEFE36 = {
|
||||
CreatedOnToolsVersion = 14.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = B0DD3889296ED65900DEFE36 /* Build configuration list for PBXProject "EmojiPickerSample" */;
|
||||
compatibilityVersion = "Xcode 14.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = B0DD3885296ED65900DEFE36;
|
||||
productRefGroup = B0DD388F296ED65900DEFE36 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
B0DD388D296ED65900DEFE36 /* EmojiPickerSample */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
B0DD388C296ED65900DEFE36 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B0DD3899296ED65B00DEFE36 /* Preview Assets.xcassets in Resources */,
|
||||
B0DD3896296ED65B00DEFE36 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
B0DD388A296ED65900DEFE36 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
B0DD3894296ED65900DEFE36 /* ContentView.swift in Sources */,
|
||||
B0DD3892296ED65900DEFE36 /* EmojiPickerSampleApp.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
B0DD389A296ED65B00DEFE36 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B0DD389B296ED65B00DEFE36 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
B0DD389D296ED65B00DEFE36 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"EmojiPickerSample/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = DU7Y9KWQXQ;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.kevinsibue.EmojiPickerSample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
B0DD389E296ED65B00DEFE36 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"EmojiPickerSample/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = DU7Y9KWQXQ;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.kevinsibue.EmojiPickerSample;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
B0DD3889296ED65900DEFE36 /* Build configuration list for PBXProject "EmojiPickerSample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B0DD389A296ED65B00DEFE36 /* Debug */,
|
||||
B0DD389B296ED65B00DEFE36 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
B0DD389C296ED65B00DEFE36 /* Build configuration list for PBXNativeTarget "EmojiPickerSample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
B0DD389D296ED65B00DEFE36 /* Debug */,
|
||||
B0DD389E296ED65B00DEFE36 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
B0DD38A2296ED75900DEFE36 /* EmojiPicker */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = EmojiPicker;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = B0DD3886296ED65900DEFE36 /* Project object */;
|
||||
}
|
||||
7
EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "smile",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/onmyway133/Smile",
|
||||
"state" : {
|
||||
"revision" : "40604722a7a56f735124e069fcbb58307637744b",
|
||||
"version" : "2.1.0"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 2
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
50
EmojiPickerSample/EmojiPickerSample/ContentView.swift
Normal file
50
EmojiPickerSample/EmojiPickerSample/ContentView.swift
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// ContentView.swift
|
||||
// EmojiPickerSample
|
||||
//
|
||||
// Created by Kévin Sibué on 11/01/2023.
|
||||
//
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// EmojiPickerSampleApp.swift
|
||||
// EmojiPickerSample
|
||||
//
|
||||
// Created by Kévin Sibué on 11/01/2023.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct EmojiPickerSampleApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user