57

GitHub - isaced/ISEmojiView: Emoji Keyboard for iOS...

 5 years ago
source link: https://github.com/isaced/ISEmojiView
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

logo Version Carthage Compatible License Platform Swift

An easy to use Emoji keyboard for iOS.

Has been rewritten with swift, the old Objective-C version on branch oc.

screenshot1.png screenshot2.png

Features

  • Written in Swift
  • Custom emojis
  • Multiple skin tone support (?????)
  • Categories bottom bar (like iOS system emoji Keyboard)
  • Recently used emoji

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Swift4
  • iOS8+
  • Xcode9

Useage

Installation

Cocoapods

# Swift
pod 'ISEmojiView'

# Objective-C
pod 'ISEmojiView', '0.0.1'

Carthage

github "isaced/ISEmojiView"

Import

import ISEmojiView

Initialization

let keyboardSettings = KeyboardSettings(bottomType: .categories)
let emojiView = EmojiView(keyboardSettings: keyboardSettings)
emojiView.translatesAutoresizingMaskIntoConstraints = false
emojiView.delegate = self
textView.inputView = emojiView

Delegate

Implement <EmojiViewDelegate>

// callback when tap a emoji on keyboard
func emojiViewDidSelectEmoji(_ emoji: String, emojiView: EmojiView) {
    textView.insertText(emoji)
}

// callback when tap change keyboard button on keyboard
func emojiViewDidPressChangeKeyboardButton(_ emojiView: EmojiView) {
    textView.inputView = nil
    textView.keyboardType = .default
    textView.reloadInputViews()
}
    
// callback when tap delete button on keyboard
func emojiViewDidPressDeleteButton(emojiView: ISEmojiView) {
    textView.deleteBackward()
}

// callback when tap dismiss button on keyboard
func emojiViewDidPressDismissKeyboardButton(_ emojiView: EmojiView) {
    textView.resignFirstResponder()
}

Customize

KeyboardSettings

This is a class to desribe keyboard settings. Available properties:

  • bottomType - type of bottom view. Available variants: .pageControl, .categories. See BottomType enum. Default .pageControl.
  • customEmojis - array of custom emojis. To describe emojis you have to use EmojiCategory class.
  • isShowPopPreview - long press to pop preview effect like iOS10 system emoji keyboard. Default is true.
  • countOfRecentsEmojis - the max number of recent emojis, if set 0, nothing will be shown. Default is 50.
  • needToShowAbcButton - need to show change keyboard button. This button is located in Categories bottom view.

Others

If you are looking for a React Native solution, take a look at this brendan-rius/react-native-emoji-keyboard

License

MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK