From 447bb0960fa0da75b975fb99fb84af2550c3635b Mon Sep 17 00:00:00 2001 From: Kelvas Date: Wed, 11 Jan 2023 16:19:08 +0100 Subject: [PATCH] first version --- EmojiPicker/.gitignore | 9 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + EmojiPicker/Package.swift | 30 ++ EmojiPicker/README.md | 3 + EmojiPicker/Sources/EmojiPicker/Emoji.swift | 20 + .../Sources/EmojiPicker/EmojiPickerView.swift | 74 ++++ .../Sources/EmojiPicker/EmojiProvider.swift | 70 ++++ .../EmojiPickerTests/EmojiPickerTests.swift | 6 + .../project.pbxproj | 374 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../xcshareddata/swiftpm/Package.resolved | 14 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 13 + .../Assets.xcassets/Contents.json | 6 + .../EmojiPickerSample/ContentView.swift | 50 +++ .../EmojiPickerSampleApp.swift | 17 + .../Preview Assets.xcassets/Contents.json | 6 + 18 files changed, 726 insertions(+) create mode 100644 EmojiPicker/.gitignore create mode 100644 EmojiPicker/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 EmojiPicker/Package.swift create mode 100644 EmojiPicker/README.md create mode 100644 EmojiPicker/Sources/EmojiPicker/Emoji.swift create mode 100644 EmojiPicker/Sources/EmojiPicker/EmojiPickerView.swift create mode 100644 EmojiPicker/Sources/EmojiPicker/EmojiProvider.swift create mode 100644 EmojiPicker/Tests/EmojiPickerTests/EmojiPickerTests.swift create mode 100644 EmojiPickerSample/EmojiPickerSample.xcodeproj/project.pbxproj create mode 100644 EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved create mode 100644 EmojiPickerSample/EmojiPickerSample/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 EmojiPickerSample/EmojiPickerSample/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 EmojiPickerSample/EmojiPickerSample/Assets.xcassets/Contents.json create mode 100644 EmojiPickerSample/EmojiPickerSample/ContentView.swift create mode 100644 EmojiPickerSample/EmojiPickerSample/EmojiPickerSampleApp.swift create mode 100644 EmojiPickerSample/EmojiPickerSample/Preview Content/Preview Assets.xcassets/Contents.json diff --git a/EmojiPicker/.gitignore b/EmojiPicker/.gitignore new file mode 100644 index 0000000..3b29812 --- /dev/null +++ b/EmojiPicker/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/EmojiPicker/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/EmojiPicker/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/EmojiPicker/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/EmojiPicker/Package.swift b/EmojiPicker/Package.swift new file mode 100644 index 0000000..1151d1a --- /dev/null +++ b/EmojiPicker/Package.swift @@ -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"]), + ] +) diff --git a/EmojiPicker/README.md b/EmojiPicker/README.md new file mode 100644 index 0000000..aaf5352 --- /dev/null +++ b/EmojiPicker/README.md @@ -0,0 +1,3 @@ +# EmojiPicker + +A description of this package. diff --git a/EmojiPicker/Sources/EmojiPicker/Emoji.swift b/EmojiPicker/Sources/EmojiPicker/Emoji.swift new file mode 100644 index 0000000..37fdbd2 --- /dev/null +++ b/EmojiPicker/Sources/EmojiPicker/Emoji.swift @@ -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 + } + +} diff --git a/EmojiPicker/Sources/EmojiPicker/EmojiPickerView.swift b/EmojiPicker/Sources/EmojiPicker/EmojiPickerView.swift new file mode 100644 index 0000000..4fcba06 --- /dev/null +++ b/EmojiPicker/Sources/EmojiPicker/EmojiPickerView.swift @@ -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, 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: ""))) + } +} diff --git a/EmojiPicker/Sources/EmojiPicker/EmojiProvider.swift b/EmojiPicker/Sources/EmojiPicker/EmojiProvider.swift new file mode 100644 index 0000000..2c44ef4 --- /dev/null +++ b/EmojiPicker/Sources/EmojiPicker/EmojiProvider.swift @@ -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) -> [String] { + return range.map({ String(UnicodeScalar($0) ?? " ") }).filter({ !$0.isEmpty }) + } + +} diff --git a/EmojiPicker/Tests/EmojiPickerTests/EmojiPickerTests.swift b/EmojiPicker/Tests/EmojiPickerTests/EmojiPickerTests.swift new file mode 100644 index 0000000..4c64aaf --- /dev/null +++ b/EmojiPicker/Tests/EmojiPickerTests/EmojiPickerTests.swift @@ -0,0 +1,6 @@ +import XCTest +@testable import EmojiPicker + +final class EmojiPickerTests: XCTestCase { + +} diff --git a/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.pbxproj b/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.pbxproj new file mode 100644 index 0000000..260a91b --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.pbxproj @@ -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 = ""; }; + B0DD3893296ED65900DEFE36 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + B0DD3895296ED65B00DEFE36 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + B0DD3898296ED65B00DEFE36 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + B0DD38A0296ED67600DEFE36 /* EmojiPicker */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = EmojiPicker; path = ../EmojiPicker; sourceTree = ""; }; +/* 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 = ""; + }; + B0DD388F296ED65900DEFE36 /* Products */ = { + isa = PBXGroup; + children = ( + B0DD388E296ED65900DEFE36 /* EmojiPickerSample.app */, + ); + name = Products; + sourceTree = ""; + }; + B0DD3890296ED65900DEFE36 /* EmojiPickerSample */ = { + isa = PBXGroup; + children = ( + B0DD3891296ED65900DEFE36 /* EmojiPickerSampleApp.swift */, + B0DD3893296ED65900DEFE36 /* ContentView.swift */, + B0DD3895296ED65B00DEFE36 /* Assets.xcassets */, + B0DD3897296ED65B00DEFE36 /* Preview Content */, + ); + path = EmojiPickerSample; + sourceTree = ""; + }; + B0DD3897296ED65B00DEFE36 /* Preview Content */ = { + isa = PBXGroup; + children = ( + B0DD3898296ED65B00DEFE36 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; + B0DD389F296ED67600DEFE36 /* Packages */ = { + isa = PBXGroup; + children = ( + B0DD38A0296ED67600DEFE36 /* EmojiPicker */, + ); + name = Packages; + sourceTree = ""; + }; + B0DD38A1296ED75900DEFE36 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* 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 */; +} diff --git a/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved new file mode 100644 index 0000000..5179f69 --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,14 @@ +{ + "pins" : [ + { + "identity" : "smile", + "kind" : "remoteSourceControl", + "location" : "https://github.com/onmyway133/Smile", + "state" : { + "revision" : "40604722a7a56f735124e069fcbb58307637744b", + "version" : "2.1.0" + } + } + ], + "version" : 2 +} diff --git a/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/AccentColor.colorset/Contents.json b/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/AppIcon.appiconset/Contents.json b/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..13613e3 --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,13 @@ +{ + "images" : [ + { + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/Contents.json b/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/EmojiPickerSample/EmojiPickerSample/ContentView.swift b/EmojiPickerSample/EmojiPickerSample/ContentView.swift new file mode 100644 index 0000000..b5a622d --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample/ContentView.swift @@ -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() + } +} diff --git a/EmojiPickerSample/EmojiPickerSample/EmojiPickerSampleApp.swift b/EmojiPickerSample/EmojiPickerSample/EmojiPickerSampleApp.swift new file mode 100644 index 0000000..59200ea --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample/EmojiPickerSampleApp.swift @@ -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() + } + } +} diff --git a/EmojiPickerSample/EmojiPickerSample/Preview Content/Preview Assets.xcassets/Contents.json b/EmojiPickerSample/EmojiPickerSample/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/EmojiPickerSample/EmojiPickerSample/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +}