### Carthage Installation Source: https://github.com/isaced/isemojiview/blob/master/README.md Integrate ISEmojiView into your project using Carthage by adding the GitHub repository to your Cartfile. ```ruby github "isaced/ISEmojiView" ``` -------------------------------- ### Import ISEmojiView Source: https://github.com/isaced/isemojiview/blob/master/README.md Import the ISEmojiView framework into your Swift file to start using its components. ```swift import ISEmojiView ``` -------------------------------- ### Swift Package Manager Installation Source: https://github.com/isaced/isemojiview/blob/master/README.md Add ISEmojiView to your project using Swift Package Manager by specifying the URL and version constraint in Package.swift. ```swift .package(name: "ISEmojiView", url: "https://github.com/isaced/ISEmojiView.git", .upToNextMinor(from: "0.3.0")), ``` -------------------------------- ### Cocoapods Installation Source: https://github.com/isaced/isemojiview/blob/master/README.md Install ISEmojiView using Cocoapods. The Swift version is recommended, while the Objective-C version is deprecated. ```ruby # Swift pod 'ISEmojiView' # Objective-C (Deprecated) pod 'ISEmojiView', '0.0.1' ``` -------------------------------- ### Add ISEmojiView via CocoaPods Source: https://context7.com/isaced/isemojiview/llms.txt Add the ISEmojiView pod to your Podfile and run 'pod install' to integrate the library into your project. ```ruby # Podfile pod 'ISEmojiView' ``` -------------------------------- ### Add ISEmojiView via Swift Package Manager Source: https://context7.com/isaced/isemojiview/llms.txt Add the ISEmojiView package to your project using Xcode or Package.swift. This is the recommended installation method for Swift projects. ```swift // Package.swift dependencies: [ .package(name: "ISEmojiView", url: "https://github.com/isaced/ISEmojiView.git", .upToNextMinor(from: "0.3.0")), ] ``` -------------------------------- ### Initialize and Configure EmojiView in UIKit Source: https://context7.com/isaced/isemojiview/llms.txt Initialize the EmojiView with custom KeyboardSettings and assign it as the input view for a UITextView. Ensure the view controller conforms to the EmojiViewDelegate protocol to handle emoji selection and button actions. ```swift import ISEmojiView import UIKit class ChatViewController: UIViewController, EmojiViewDelegate { @IBOutlet private var textView: UITextView! override func viewDidLoad() { super.viewDidLoad() // Configure keyboard settings let keyboardSettings = KeyboardSettings(bottomType: .categories) keyboardSettings.countOfRecentsEmojis = 20 keyboardSettings.isShowPopPreview = true keyboardSettings.needToShowAbcButton = true keyboardSettings.needToShowDeleteButton = true keyboardSettings.updateRecentEmojiImmediately = true // Create emoji view and set as input view let emojiView = EmojiView(keyboardSettings: keyboardSettings) emojiView.translatesAutoresizingMaskIntoConstraints = false emojiView.delegate = self textView.inputView = emojiView } // MARK: - EmojiViewDelegate func emojiViewDidSelectEmoji(_ emoji: String, emojiView: EmojiView) { textView.insertText(emoji) } func emojiViewDidPressChangeKeyboardButton(_ emojiView: EmojiView) { // Switch back to system keyboard textView.inputView = nil textView.keyboardType = .default textView.reloadInputViews() } func emojiViewDidPressDeleteBackwardButton(_ emojiView: EmojiView) { textView.deleteBackward() } func emojiViewDidPressDismissKeyboardButton(_ emojiView: EmojiView) { textView.resignFirstResponder() } } ``` -------------------------------- ### Manage Emoji Models with Skin Tones Source: https://context7.com/isaced/isemojiview/llms.txt Create Emoji instances with skin tone variants and utilize Codable for persistence. ```swift import ISEmojiView // Simple emoji without skin tones let simpleEmoji = Emoji(emojis: ["😀"]) print(simpleEmoji.emoji) // "😀" (default emoji) // Emoji with skin tone variants (6 variants: default + 5 skin tones) let waveEmoji = Emoji(emojis: [ "👋", // Default (yellow) "👋🏻", // Light skin tone "👋🏼", // Medium-light skin tone "👋🏽", // Medium skin tone "👋🏾", // Medium-dark skin tone "👋🏿" // Dark skin tone ]) // Access properties print(waveEmoji.emoji) // "👋" (first/default) print(waveEmoji.emojis) // ["👋", "👋🏻", "👋🏼", "👋🏽", "👋🏾", "👋🏿"] print(waveEmoji.selectedEmoji) // nil (set when user selects a variant) // After user selects a skin tone (handled internally by EmojiView): // waveEmoji.selectedEmoji = "👋🏽" // Emoji conforms to Codable for persistence let encoder = JSONEncoder() let data = try? encoder.encode(waveEmoji) let decoder = JSONDecoder() let decoded = try? decoder.decode(Emoji.self, from: data!) ``` -------------------------------- ### Initialize Emoji Keyboard Source: https://github.com/isaced/isemojiview/blob/master/README.md Initialize an EmojiView with custom keyboard settings and assign it as the input view for a text view. Ensure to set the delegate for callbacks. ```swift let keyboardSettings = KeyboardSettings(bottomType: .categories) let emojiView = EmojiView(keyboardSettings: keyboardSettings) emojiView.translatesAutoresizingMaskIntoConstraints = false emojiView.delegate = self textView.inputView = emojiView ``` -------------------------------- ### Implement EmojiViewDelegate for Keyboard Events Source: https://context7.com/isaced/isemojiview/llms.txt Use this protocol to handle user interactions like selecting emojis or switching keyboards. Ensure the delegate is assigned to the EmojiView instance. ```swift import ISEmojiView import UIKit class MessageComposer: UIViewController, EmojiViewDelegate { @IBOutlet var messageTextField: UITextField! private var emojiKeyboard: EmojiView! override func viewDidLoad() { super.viewDidLoad() setupEmojiKeyboard() } private func setupEmojiKeyboard() { let settings = KeyboardSettings(bottomType: .categories) settings.needToShowAbcButton = true emojiKeyboard = EmojiView(keyboardSettings: settings) emojiKeyboard.delegate = self emojiKeyboard.translatesAutoresizingMaskIntoConstraints = false messageTextField.inputView = emojiKeyboard } // Required: Called when user taps an emoji func emojiViewDidSelectEmoji(_ emoji: String, emojiView: EmojiView) { // Insert the selected emoji into the text field if let selectedRange = messageTextField.selectedTextRange { messageTextField.replace(selectedRange, withText: emoji) } } // Optional: Called when ABC/keyboard switch button is pressed func emojiViewDidPressChangeKeyboardButton(_ emojiView: EmojiView) { messageTextField.inputView = nil messageTextField.reloadInputViews() } // Optional: Called when delete/backspace button is pressed func emojiViewDidPressDeleteBackwardButton(_ emojiView: EmojiView) { messageTextField.deleteBackward() } // Optional: Called when dismiss keyboard button is pressed func emojiViewDidPressDismissKeyboardButton(_ emojiView: EmojiView) { messageTextField.resignFirstResponder() } } ``` -------------------------------- ### Integrate EmojiView via Storyboard Source: https://context7.com/isaced/isemojiview/llms.txt Connect EmojiView as an IBOutlet in a UIViewController and implement the EmojiViewDelegate to handle user input. ```swift import UIKit import ISEmojiView class StoryboardEmojiViewController: UIViewController, EmojiViewDelegate { // Connect EmojiView from Storyboard @IBOutlet private var textView: UITextView! @IBOutlet private var emojiView: EmojiView! { didSet { // Set delegate when outlet is connected emojiView.delegate = self } } // IBInspectable properties available in Interface Builder: // - Bottom Type (Int): 0 = pageControl, 1 = categories // - Is Show Pop Preview (Bool): Enable/disable long-press preview // - Count Of Recents Emojis (Int): Max recent emojis // - Need To Show Abc Button (Bool): Show keyboard switch button // MARK: - EmojiViewDelegate func emojiViewDidSelectEmoji(_ emoji: String, emojiView: EmojiView) { textView.insertText(emoji) } func emojiViewDidPressDeleteBackwardButton(_ emojiView: EmojiView) { textView.deleteBackward() } } ``` -------------------------------- ### Configure KeyboardSettings for EmojiView Source: https://context7.com/isaced/isemojiview/llms.txt Customize the appearance and behavior of the ISEmojiView using the KeyboardSettings class. Options include bottom navigation type, recent emoji count, preview popups, and button visibility. ```swift import ISEmojiView // Create settings with page control navigation let pageControlSettings = KeyboardSettings(bottomType: .pageControl) // Create settings with category icons navigation let categorySettings = KeyboardSettings(bottomType: .categories) // Configure all available options let keyboardSettings = KeyboardSettings(bottomType: .categories) // Type of bottom view: .pageControl or .categories keyboardSettings.bottomType = .categories // Maximum number of recent emojis (0 to disable) keyboardSettings.countOfRecentsEmojis = 50 // Default: 50 // Show long-press preview popup (iOS 10+ style) keyboardSettings.isShowPopPreview = true // Default: true // Show ABC button to switch to system keyboard keyboardSettings.needToShowAbcButton = false // Default: false // Show delete/backspace button keyboardSettings.needToShowDeleteButton = true // Default: true // Update recent emojis immediately vs on popup dismiss keyboardSettings.updateRecentEmojiImmediately = true // Default: true // Optional: Set custom emoji categories keyboardSettings.customEmojis = [/* EmojiCategory array */] ``` -------------------------------- ### Define Custom Emoji Categories Source: https://context7.com/isaced/isemojiview/llms.txt Create personalized emoji sets by defining Emoji objects and grouping them into EmojiCategory instances. Icons must be present in the app's asset catalog. ```swift import ISEmojiView // Create emojis - each Emoji can have skin tone variants let happyEmoji = Emoji(emojis: ["😀"]) let thumbsUpEmoji = Emoji(emojis: ["👍", "👍🏻", "👍🏼", "👍🏽", "👍🏾", "👍🏿"]) // With skin tones let heartEmoji = Emoji(emojis: ["❤️"]) let starEmoji = Emoji(emojis: ["⭐"]) // Create custom category with title and icon name // Icon must exist in your app's asset catalog let customCategory = EmojiCategory( category: Category.custom("Favorites", "ic_customCategory"), emojis: [happyEmoji, thumbsUpEmoji, heartEmoji, starEmoji] ) // Create another category let reactionsCategory = EmojiCategory( category: Category.custom("Reactions", "ic_reactions"), emojis: [ Emoji(emojis: ["😂"]), Emoji(emojis: ["🤣"]), Emoji(emojis: ["😍"]), Emoji(emojis: ["🔥"]), Emoji(emojis: ["💯"]) ] ) // Apply custom categories to keyboard settings let keyboardSettings = KeyboardSettings(bottomType: .categories) keyboardSettings.customEmojis = [customCategory, reactionsCategory] keyboardSettings.countOfRecentsEmojis = 10 let emojiView = EmojiView(keyboardSettings: keyboardSettings) ``` -------------------------------- ### EmojiViewDelegate - Change Keyboard Source: https://github.com/isaced/isemojiview/blob/master/README.md Implement the emojiViewDidPressChangeKeyboardButton delegate method to switch the input view back to the system keyboard. ```swift // callback when tap change keyboard button on keyboard func emojiViewDidPressChangeKeyboardButton(_ emojiView: EmojiView) { textView.inputView = nil textView.keyboardType = .default textView.reloadInputViews() } ``` -------------------------------- ### Load Emoji Data with EmojiLoader Source: https://context7.com/isaced/isemojiview/llms.txt Use EmojiLoader's static methods to load emoji categories from plist files. It automatically selects the correct plist based on the iOS version. You can load all categories, the recent emoji category, or combine them with custom categories for keyboard settings. ```swift import ISEmojiView // Load all built-in emoji categories // Automatically uses iOS-version-appropriate emoji list let categories: [EmojiCategory] = EmojiLoader.emojiCategories() // iOS 10: Uses ISEmojiList_iOS10.plist // iOS 11: Uses ISEmojiList_iOS11.plist // iOS 12.1+: Uses ISEmojiList_iOS12.1.plist // iOS 18+: Uses ISEmojiList.plist // Load recent emoji category let recentsCategory: EmojiCategory = EmojiLoader.recentEmojiCategory() // Combine with custom categories var allCategories = [recentsCategory] allCategories.append(contentsOf: EmojiLoader.emojiCategories()) // Use in keyboard settings let settings = KeyboardSettings(bottomType: .categories) settings.customEmojis = allCategories ``` -------------------------------- ### SwiftUI EmojiView Integration Source: https://github.com/isaced/isemojiview/blob/master/README.md Use the EmojiView_SwiftUI struct to integrate the emoji keyboard into your SwiftUI views. Customize its frame and padding as needed. ```swift import ISEmojiView EmojiView_SwiftUI() .frame(width: 300, height: 500) .padding() ``` -------------------------------- ### EmojiViewDelegate - Dismiss Keyboard Source: https://github.com/isaced/isemojiview/blob/master/README.md Implement the emojiViewDidPressDismissKeyboardButton delegate method to dismiss the emoji keyboard and resign first responder status from the text view. ```swift // callback when tap dismiss button on keyboard func emojiViewDidPressDismissKeyboardButton(_ emojiView: EmojiView) { textView.resignFirstResponder() } ``` -------------------------------- ### EmojiViewDelegate - Select Emoji Source: https://github.com/isaced/isemojiview/blob/master/README.md Implement the emojiViewDidSelectEmoji delegate method to handle emoji selection by inserting the emoji into the text view. ```swift // callback when tap a emoji on keyboard func emojiViewDidSelectEmoji(_ emoji: String, emojiView: EmojiView) { textView.insertText(emoji) } ``` -------------------------------- ### Integrate Emoji Keyboard in SwiftUI with EmojiView_SwiftUI Source: https://context7.com/isaced/isemojiview/llms.txt Use EmojiView_SwiftUI to embed the UIKit EmojiView in SwiftUI applications. Configure various aspects like button visibility, recent emoji count, and callbacks for emoji selection, keyboard changes, and deletion. Note: This component does not natively support macOS SwiftUI. ```swift import SwiftUI import ISEmojiView struct ChatView: View { @State private var messageText = "" @State private var showEmojiKeyboard = false var body: some View { VStack { // Message display area Text(messageText) .font(.title) .padding() // Toggle emoji keyboard Button(showEmojiKeyboard ? "Hide Emoji Keyboard" : "Show Emoji Keyboard") { showEmojiKeyboard.toggle() } .padding() // Emoji keyboard view if showEmojiKeyboard { EmojiView_SwiftUI( needToShowAbcButton: true, needToShowDeleteButton: true, updateRecentEmojiImmediately: true, countOfRecentsEmojis: 30, didSelect: { emoji in messageText += emoji }, didPressChangeKeyboard: { showEmojiKeyboard = false }, didPressDeleteBackward: { if !messageText.isEmpty { messageText.removeLast() } }, dDidPressDismissKeyboard: { showEmojiKeyboard = false } ) .frame(height: 300) } } } } // Simple usage without callbacks struct SimpleEmojiPicker: View { var body: some View { EmojiView_SwiftUI() .frame(width: 300, height: 500) .padding() } } ``` -------------------------------- ### Manage Recent Emojis with RecentEmojisManager Source: https://context7.com/isaced/isemojiview/llms.txt Access the shared instance of RecentEmojisManager to retrieve, display, and add recent emojis. It persists data using UserDefaults and sorts emojis by usage frequency. The `add` method has a `maxCount` parameter to limit the number of stored recents. ```swift import ISEmojiView // Access the shared instance let recentManager = RecentEmojisManager.sharedInstance // Get all recent emojis (sorted by frequency) let recentEmojis: [Emoji] = recentManager.recentEmojis() // Display recent emojis for emoji in recentEmojis { print("Emoji: \(emoji.emoji)") print("Selected variant: \(emoji.selectedEmoji ?? emoji.emoji)") print("All variants: \(emoji.emojis ?? [])") } // Add emoji to recents programmatically // Note: This is typically handled automatically by EmojiView let newEmoji = Emoji(emojis: ["👋", "👋🏻", "👋🏼", "👋🏽", "👋🏾", "👋🏿"]) let wasAdded = recentManager.add( emoji: newEmoji, selectedEmoji: "👋🏽", // The specific skin tone selected maxCount: 50 // Maximum recent emojis to keep ) ``` -------------------------------- ### Configure Emoji Keyboard Navigation with BottomType Source: https://context7.com/isaced/isemojiview/llms.txt The BottomType enum configures the emoji keyboard's bottom bar navigation style. Choose between '.pageControl' for page dots or '.categories' for category icons. The raw values for these enums are 0 and 1, respectively. ```swift import ISEmojiView // Page control style - dots indicating current page let pageControlSettings = KeyboardSettings(bottomType: .pageControl) // Shows: [delete button] [• • • • •] (page dots) // Categories style - category icons for quick navigation let categoriesSettings = KeyboardSettings(bottomType: .categories) // Shows: [ABC] [🕐] [😀] [🐱] [🍎] [⚽] [✈️] [💡] [#] [🏁] [⌫] // Access raw value if needed let rawValue = BottomType.pageControl.rawValue // 0 let rawValue2 = BottomType.categories.rawValue // 1 ``` -------------------------------- ### EmojiViewDelegate - Delete Backward Source: https://github.com/isaced/isemojiview/blob/master/README.md Implement the emojiViewDidPressDeleteBackwardButton delegate method to handle the delete action, removing the last character from the text view. ```swift // callback when tap delete button on keyboard func emojiViewDidPressDeleteBackwardButton(_ emojiView: EmojiView) { textView.deleteBackward() } ``` -------------------------------- ### Access Built-in Category Enum Source: https://context7.com/isaced/isemojiview/llms.txt Use the Category enum to reference standard emoji categories or define custom ones. Properties like title and iconName are available for both built-in and custom types. ```swift import ISEmojiView // Available built-in categories let categories: [Category] = [ .recents, // "Frequently Used" - automatically managed .smileysAndPeople, // "Smileys & People" .animalsAndNature, // "Animals & Nature" .foodAndDrink, // "Food & Drink" .activity, // "Activity" .travelAndPlaces, // "Travel & Places" .objects, // "Objects" .symbols, // "Symbols" .flags // "Flags" ] // Custom category with title and icon name let custom = Category.custom("My Category", "ic_my_icon") // Access category properties let title = Category.smileysAndPeople.title // "Smileys & People" let iconName = Category.smileysAndPeople.iconName // "ic_smileys_people" // Custom category properties let customTitle = custom.title // "My Category" let customIcon = custom.iconName // "ic_my_icon" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.