MemojiView - MemojiView works by having a TextView behind the actual View for user input

Related tags

Image MemojiView
Overview

MemojiView

Platform Swift 5.0 iOS 13.0+ MIT



Banner

Since there is no official API for using the users Memoji's i have built a simple view to retrieve them and use them to your liking.

MemojiView works by having a TextView behind the actual View for user input. The passed string is converted to an image and displayed in the view. That could also lead that users input character or emoji's with will also be converted to images. Either conform to the delegate and display a warning if the users selects anything than a memoji or simply accepts any kind of input.

Quick start


preview1                               preview2
MemojiView
let memojiView = MemojiView(frame: .zero)
memojiView.tintColor = .purple

self.view.addSubview(memojiView)   
Image types

MemojiView has 3 types of images.

  • memoji: Is a single Memoji image.
  • emoji: Is a single Emoji image.
  • text(Int) : Is a String converted to an image with the number of letters in it
enum ImageType: Equatable {
    case memoji, emoji, text(Int)
}
Delegate

To respond to changes of the image, implement the MemojiViewDelegate protocol in your class, e.g. a View Controller, and then set the views delegate property:

class MyViewController: UIViewController, MemojiViewDelegate {
  override func viewDidLoad() {
    super.viewDidLoad()

    let memojiView = MemojiView(frame: .zero)
    memojiView.delegate = self
  }

  // MemojiView delegate
 func didUpdateImage(image: UIImage, type: ImageType) {
    // Do something with the image or check the type of the image and respond accordingly.
 }
}

Or use the Closure for processing the image:

memojiView.onChange = { image, imageType in
    // Do something on image change   
}

Demo

demo.gif
Text input

Like previously stated we can't really control the keyboard and therefore the input of the user. Simply changing the Keyboard type will lead to different results. Using the default Character Keyboard will also convert them to images.

demo_text.gif

Requirements

  • Xcode 11
  • iOS 12 or later
  • Swift 5 or later

Installation

CocoaPods

You can use CocoaPods to install MemojiView by adding it to your Podfile:

pod 'MemojiView'
Installing MemojiView manually
  1. Download MemojiView.zip from the last release and extract its content in your project's folder.
  2. From the Xcode project, choose Add Files to ... from the File menu and add the extracted files.

Contribute

Contributions are highly appreciated! To submit one:

  1. Fork
  2. Commit changes to a branch in your fork
  3. Push your code and make a pull request
You might also like...
A view controller for iOS that allows users to crop portions of UIImage objects
A view controller for iOS that allows users to crop portions of UIImage objects

TOCropViewController TOCropViewController is an open-source UIViewController subclass to crop out sections of UIImage objects, as well as perform basi

A custom image view that implements device motion scrolling
A custom image view that implements device motion scrolling

YXTMotionView A custom image view that implements device motion scrolling Installation CocoaPods Add the dependency to your Podfile: platform :ios pod

A simple iOS photo and video browser with grid view, captions and selections.
A simple iOS photo and video browser with grid view, captions and selections.

MWPhotoBrowser A simple iOS photo and video browser with optional grid view, captions and selections. MWPhotoBrowser can display one or more images or

A view that takes a set of images, make transition from one to another by using flipping effects.
A view that takes a set of images, make transition from one to another by using flipping effects.

CDFlipView A view that takes a set of images, make transition from one to another by using flipping effects. Demo Live Demo: https://appetize.io/app/w

Shows a list of albums initially and shows the image in detailed view.

Description : PhotosViewer Shows a list of albums initially. Selcting any album will lead to a photos list screen Tapping on any photo will display a

PrivateImage - DRM image view for UIKit and SwiftUI
PrivateImage - DRM image view for UIKit and SwiftUI

SecretImage Image view with DRM protection for SwiftUI and UIKit. What? This vie

SwiftUI view that download and display image from URL and displaying Activity Indicator while loading .

ViewWithActivityIndicator ViewWithActivityIndicator is a SwiftUI view that download and display image from URL and displaying Activity Indicator while

MSLView - Shadertoy-style SwiftUI view

MSLView SwiftUI view for Shadertoy-style MSL shaders import MSLView struct Cons

Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.
Media view which subclasses UIImageView, and can display & load images, videos, GIFs, and audio and from the web, and has functionality to minimize from fullscreen, as well as show GIF previews for videos.

I've built out the Swift version of this library! Screenshots Description ABMediaView can display images, videos, as well as now GIFs and Audio! It su

Owner
Emre Armagan
Golang, Swift, Java, Python - Full-time computer-science student at the University of Hamburg.
Emre Armagan
A custom ImageView that is used to cover the surface of other view like a scratch card, user can swipe the mulch to see the view below.

MCScratchImageView GIF Showcase Requirments iOS 8.0+ Xcode 7.2+ Swift 4.0 Installation CocoaPods pod "MCScratchImageView" Manually Just drag MCScratch

Jaylen Bian 359 Dec 17, 2022
Generate random user Avatars for apps.

Avatar Generate random user Avatars for apps. Works for iOS 9.3+ Installation Simply install using Cocoapods, add 'pod Avatar' to your podfile Simple

William Vabrinskas 24 Nov 3, 2022
Create ImageView for User or Group like Messenger app

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

Laurent Grondin 29 Mar 8, 2022
DGLoading - A loading view that is shown at center of the current view

DGLoading A loading view that is shown at center of the current view. Requiremen

donggyu 5 Jan 26, 2022
An image download extension of the image view written in Swift for iOS, tvOS and macOS.

Moa, an image downloader written in Swift for iOS, tvOS and macOS Moa is an image download library written in Swift. It allows to download and show an

Evgenii Neumerzhitckii 330 Sep 9, 2022
AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.

URLImage URLImage is a SwiftUI view that displays an image downloaded from provided URL. URLImage manages downloading remote image and caching it loca

Dmytro Anokhin 1k Jan 4, 2023
AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.

AYImageKit AYImageKit is a Swift Library for Async Image Downloading. Features Async Image Downloading. Can Show Text Initials. Can have Custom Styles

Adnan Yousaf 11 Jan 10, 2022
PrettyBorder is a SwiftUI package for managing an customized border and background at any kind of view.

PrettyBorder Description PrettyBorder is a SwiftUI package for managing an customized border and background at any kind of view. Preview of end result

Ahmet Giray Uçar 2 Oct 13, 2021
A SwiftUI view for displaying image histograms

HistogramView A SwiftUI view for displaying image histograms. How do I use it? It's as simple as: HistogramView(image: myImage) Note: Both UIImage & N

Vasilis Akoinoglou 11 Dec 14, 2022
Drop in GIF Collection View. Uses Tenor as default GIFs provider.

Drop in GIF Collection View. Uses Tenor as default GIFs provider. This will allow you to easily integrate GIF image search into your app or you can use this as a GIF keyboard for your messaging needs.

null 5 May 7, 2022