Swiftpack.co -  lojals/ReactionButton as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
lojals/ReactionButton
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.
.package(url: "https://github.com/lojals/ReactionButton.git", from: "4.0.0")


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, jroz9105@gmail.com

GitHub

link
Stars: 306
Last commit: 21 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

4.0.0
32 weeks ago
  • 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

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API