MCEmojiPicker Documentation
repository·main·Indexed 19 days ago
https://github.com/izyumkin/mcemojipickerA customizable library for implementing a macOS-style emoji picker popover in iOS applications. Supports UIKit via MCEmojiPickerViewController and SwiftUI via the .emojiPicker view modifier. Installable via CocoaPods, Swift Package Manager, or manual integration.
What's inside MCEmojiPicker
- The library currently does not support two-part emojis (e.g., complex combinations like 🫱🏿🫲🏻). It does support standard skin tone variations like 🤝🏻 or 🤝🏿.
Install MCEmojiPicker via CocoaPods
mainTo integrate
MCEmojiPickerinto your Xcode project using CocoaPods, add the following line to yourPodfile:pod 'MCEmojiPicker'Quick Start: Presenting the Emoji Picker in UIKit
mainTo use the emoji picker in a UIKit application, instantiate
MCEmojiPickerViewController, set itsdelegateandsourceView, and present it from a view controller.@objc private func selectEmojiAction(_ sender: UIButton) { let viewController = MCEmojiPickerViewController() viewController.delegate = self viewController.sourceView = sender present(viewController, animated: true) } // Handle the selection in the delegate method extension ViewController: MCEmojiPickerDelegate { func didGetEmoji(emoji: String) { emojiButton.setTitle(emoji, for: .normal) } }Install MCEmojiPicker via Swift Package Manager
mainTo integrate
MCEmojiPickerusing Swift Package Manager, add the repository URL in Xcode underProject > Swift Packages:https://github.com/izyumkin/MCEmojiPickerInstall MCEmojiPicker manually
mainTo install manually, add theSource/MCEmojiPickerfolder to your Xcode project. Ensure thatCopy items if neededandCreate groupsare selected during the import process.Use MCEmojiPicker in SwiftUI
mainYou can use
MCEmojiPickerin SwiftUI using the.emojiPickerview modifier or by interacting directly withMCEmojiPickerRepresentableController.// Using the view modifier Button(selectedEmoji) { isPresented.toggle() }.emojiPicker( isPresented: $isPresented, selectedEmoji: $selectedEmoji ) // Using the Representable Controller directly MCEmojiPickerRepresentableController( isPresented: $isPresented, selectedEmoji: $selectedEmoji, arrowDirection: .up, customHeight: 380.0, horizontalInset: .zero, isDismissAfterChoosing: true, selectedEmojiCategoryTintColor: .systemBlue, feedBackGeneratorStyle: .light )Configure MCEmojiPickerViewController properties
mainYou can customize the appearance and behavior of
MCEmojiPickerViewControllerusing the following properties:selectedEmojiCategoryTintColor: The color for the selected emoji category. Default is.systemBlue.arrowDirection: The direction of the popover arrow. Default is.up.horizontalInset: The inset from thesourceViewborder. Default is0.isDismissAfterChoosing: Whether to dismiss the picker after an emoji is selected. Default istrue.customHeight: A custom height for the picker. Default isnil.feedBackGeneratorStyle: The haptic feedback style. Default is.light. Set tonilto disable feedback.
viewController.selectedEmojiCategoryTintColor = .systemRed viewController.arrowDirection = .up viewController.horizontalInset = 0 viewController.isDismissAfterChoosing = true viewController.customHeight = 300 viewController.feedBackGeneratorStyle = .soft