ReactionButton is a control that allows developers to add this functionality to their apps in an easy way.

Overview


Since Facebook introduced reactions in 2016, it became a standard in several applications as a way for users to interact with content. ReactionButton is a control that allows developers to add this functionality to their apps in an easy way.

Features

  • Support of Dark Mode
  • Customizable layout using ReactionButtonDelegateLayout
  • Extensible DataSource for the control
  • Layout support for scrolling interfaces (UICollectionView/UITableView)
  • Codable initializer for usage on storyboards
  • Events

Requirements

  • iOS 13.0+
  • Swift 5.0+

Installation

Usage

1. Basic Instance

There are multiple ways to instantiate a ReactionButton, using a frame, storyboards, or an empty convenience initializer.

Example Code

let buttonSample = ReactionButton(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
buttonSample.dataSource = self
view.addSubview(buttonSample)

Basic usage

Images from Trump reactionpacks style.

2. Delegate

The ReactionButton has a delegate to communicate events of option selection, option focus, and cancel of actions. To use it, set the ReactionButtonDelegate conform as a delegate.

let buttonSample = ReactionButton(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
buttonSample.delegate = self
view.addSubview(buttonSample)

Delegate example

Images from Trump reactionpacks style.

3. Custom layout instance

ReactionButton allows customization of the layout with the help of ReactionButtonDelegateLayout. To use it, please conform to that protocol and set it as delegate (Same pattern as UICollectionView).

func ReactionSelectorConfiguration(_ selector: ReactionButton) -> ReactionButton.Config {
  ReactionButton.Config(spacing: 2,
                        size: 30,
                        minSize: 34,
                        maxSize: 45,
                        spaceBetweenComponents: 30)
}

You can custom your selector with the following variables, used in the

New

sizes

Author

Jorge Ovalle, [email protected]

Comments
  • selectedOption never get called

    selectedOption never get called

    Hi, I am trying your example however, I see that the selectedOption here never gets called so I don't get chance to check if user select something. Overtime, its showing "User cancelled".

    opened by satyamub 15
  • Inconsistent with familiar user experience

    Inconsistent with familiar user experience

    Of course this is a familiar user experience on Facebook: While the difference is small - it is important in this control user has to:

    • click once to activate view
    • click a second time to pick emoji While on FB user (long presses) once and immediately the toolbar is activated and shown I believe as an alternative implementation a long press event is more familiar.
    wontfix 
    opened by emouawad 2
  • iOS 7

    iOS 7

    Can you please change JOTextField.podspec

    s.platform = :ios, '7.0'

    It seems to work perfectly on iOS 7 but I can't use it via cocoapods until that line is changed.

    opened by pjebs 1
  • Add features for V4.0.0

    Add features for V4.0.0

    This PR adds:

    • Support to Swift 5
    • Increase target to iOS 13
    • Add support to Tableview and CollectionView usage
    • Improve interface
    • New DataSource and layout protocols
    • Update CocoaPod version
    • Support for DarkMode and multiple traits
    opened by lojals 0
  • Can we select emojis with out moving finger?

    Can we select emojis with out moving finger?

    We want to hold the emoji view on the screen and then select without dragging a finger. Like Facebook and LinkedIn do.

    Your support would be appreciated.

    Thanks!!

    opened by vish0289 2
  • Reactions does not show up in presented view controller

    Reactions does not show up in presented view controller

    Here is the reproducible example.

    https://user-images.githubusercontent.com/2767152/104798871-191a8980-57ec-11eb-87d6-839cba92fb41.mov

    ReactionButton.zip

    opened by mzeeshanid 3
Releases(4.0.0)
  • 4.0.0(Nov 1, 2020)

    • Support to Swift 5
    • Increase target to iOS 13
    • Add support to Tableview and CollectionView usage
    • Improve interface
    • New DataSource and layout protocols
    • Update CocoaPod version
    • Support for DarkMode and multiple traits
    • Add support for Swift Package Manager
    Source code(tar.gz)
    Source code(zip)
Owner
Jorge Ovalle
∆ Sr. iOS Engineer @ Uber  ∆ | he/him | My commits are my own | Oppa
Jorge Ovalle
Stocks-App - App that allows the user to track stocks of their choice

Stocks-App App that allows the user to track stocks of their choice (Coming soon

Eli Hartnett 0 Jul 9, 2022
This is an app for a craft beer company called Cacique Bier that allows to see their available products and place orders. Made with Swift and SwiftUI.

Cacique Bier App This is an app for a Craft Beer company that shows their catalogue of products and in the future will allow purchases. The app is com

Augusto Galindo Ali 5 Jun 21, 2022
Control Room : a macOS app that lets you control the simulators for iOS, tvOS, and watchOS

Control Room is a macOS app that lets you control the simulators for iOS, tvOS, and watchOS – their UI appearance, status bar configuration, and more.

null 0 Nov 30, 2021
Lightweight library helping to embed Mercuryo Widget into their mobile apps

Mercuryo-Widget Mercuryo Widget Wrapper is a lightweight library for developers of apps who embed Mercuryo Widget into their mobile UX. Solely purpose

Mercuryo.io 3 Apr 22, 2022
Add to-do List - a mobile application where you can add your to-dos and follow them

This project, is a mobile application where you can add your to-dos and follow them. You can add your to-do's.

Cem 4 Apr 1, 2022
Cookbook app that allows you to read, add and modify your recipes.

What-s-For-Dinner-iOS-App Cookbook app that allows you to read, add and modify your recipes. Features ?? ?? View You can see recipes divided into cate

Katie Saramutina 2 May 18, 2022
ToDoList - An ios app that help users to set their todos and make it easy to remember this todos

An ios app that help users to set their todos and make it easy to remember this todos by reminders them when todo time's up, this app make sure that you don't forget any todos that you want to do just give it to the app and let the app hundle it for you.

Ahmed Mahrous 1 Apr 25, 2022
In-app console and debug tools for iOS developers.

LocalConsole Welcome to LocalConsole! This Swift Package makes on-device debugging easy with a convenient PiP-style console that can display items in

Duraid Abdul 609 Sep 26, 2022
You can share and communicate with developers around the world through the Fabula app.

FabulaItemsProvider This is the source package for the Fabula project. You can share and communicate with developers around the world through the Fabu

jasu 181 Sep 23, 2022
DevToys for iPad - a SwiftUI reimplementation of DevToys, a Swiss Army Knife for developers, for iPadOS

DevToys for iPad - a SwiftUI reimplementation of DevToys, a Swiss Army Knife for developers, for iPadOS

Kenta Kubo 19 Jul 28, 2022
This app is a native client for openHAB which allows easy access to your sitemaps

openHAB client for iOS Introduction This app is a native client for openHAB which allows easy access to your sitemaps. Beta releases are available on

openHAB 169 Jul 27, 2022
The demo project to show how to organize code to make SwiftUI apps easy to be test.

TestableApp I combined the idea to use functional programming instead of an loader instance in ModelView(I prefer to think of it as a service) and Res

VictorK 2 Jan 7, 2022
App which lets two people share their social media details by simply putting one phone on top of the other ("tapping"). Currently in development by Nikita Mounier.

Tap It Tap It enables two people to seamlessly share their social media information (e.g. Instagram, Snapchat, phone number) by simply placing one scr

Nikita Mounier 23 Sep 19, 2022
A todo list iOS app developed with swift5 and coredata to persist data, this app help people organise their tasks on categories.

A todo list iOS app developed with swift5 and coredata to persist data, this app help people organise their tasks on categories. The app is simple, intuitive, and easy to use and update tasks informations.

null 1 Nov 17, 2021
An App that gives a nice interface where the user can type in their start location and destination

SixtCarSummoner What it does We developed an App that gives a nice interface where the user can type in their start location and destination. The user

Dominik Schiwietz 1 Nov 21, 2021
Rhythm helps those with Parkinson's more easily coordinate their gait with rhythmic audio.

Rhythm-Parkinson-s-App Rhythm helps those with Parkinson's more easily coordinate their gait with rhythmic audio. Research https://davisphinneyfoundat

Andreas Ink 1 Dec 13, 2021
Forecast App is an ios application built on top of omdb movie api for batman lovers to see their favorite batman movies

Catbon-Movie-App Forecast App is an ios application built on top of omdb movie api for batman lovers to see their favorite batman movies, users can al

GuruKing 0 Dec 6, 2021
SwiftUI-pokedexApp - Pokedex app. Libarary of pokemons and their description

SwiftUI-pokedexApp Pokedex app. Libarary of pokemons and their description (UNFI

Yerkebulan Serikov 1 Sep 19, 2022