• Stars
    star
    1,167
  • Rank 40,028 (Top 0.8 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple and easily customizable InputAccessoryView for making powerful input bars with autocomplete and attachments

Image

InputBarAccessoryView

Features

  • Autocomplete text with @mention, #hashtag or any other prefix
  • A self-sizing UITextView with an optional fixed height (can be replaced with any other view)
  • Image paste support
  • Autocomplete attributed text highlighting
  • Reactive components that respond to given events
  • Top/Bottom/Left/Right InputStackViews that act as toolbars to place buttons
  • Drop in attachment view for file/photo management
  • Plugin support for your own InputPlugins
  • Compatible with all iPhones and iPads
  • RTL Support

Installation via Swift Package Manager (SPM)

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. Once you have your Swift package set up, adding InputBarAccessoryView as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/nathantannar4/InputBarAccessoryView.git", .upToNextMajor(from: "6.0.0"))
]

You can also add it via Xcode SPM editor with URL:

https://github.com/nathantannar4/InputBarAccessoryView.git

Requirements

iOS 13.0+ Swift 5.5

The latest iOS 12 release is v5.5.0

CocoaPods and RxExtensions were removed in 6.0.0

The latest iOS 11 release is v5.1.0

The latest Swift 5.0 release is v5.1.0

The latest Swift 4.2 release is v4.2.2

Documentation

Getting Started

See the Example project to see how you can make the iMessage, Slack, Facebook and GitHawk input bars!

Example Usage

Featured In

Add your app to the list of apps using this library and make a pull request.

See Also

iMessage style TypingIndicator for chat apps

Latest Releases

6.2.0

  • Remove canBecomeFirstResponder on InputTextView to fix UITextViewDelegate methods not being called

6.1.1

  • Fixed warning for Xcode 14

6.1.0

  • #230 Added additionalInputViewBottomConstraintConstant to KeyboardManager as a way for providing additional bottom constraint constant offset for inputAccessoryView. Example implementation can be found in AdditionalBottomSpaceExampleViewController

6.0.0

  • Breaking change: Drop iOS 12 support
  • Breaking change: Drop CocoaPods support & RxSwift extension (it was available only via CocoaPods)
  • KeyboardManager will not update position of inputAccessoryView from interactive dismiss panGesture when the keyboard is floating
  • Update docs

5.5.0

  • Update SPM tools to Swift 5.5
  • Added new optional delegate method for custom attachments size
  • Added new animations for left/right stack view constraints

5.4.0

  • Make sure framework is ready for Xcode 13
  • Fix availability in AppExtensions
  • Fix Package.swift to support iOS 12+ only

See CHANGELOG for more details and older releases.

Find a bug? Open an issue!

Layout

The layout of the InputBarAccessoryView is made of of 4 InputStackView's and an InputTextView. The padding of the subviews can be easily adjusted by changing the padding and textViewPadding properties. The constraints will automatically be updated.

It is important to note that each of the InputStackView 's to the left and right of the InputTextView are anchored by a width constraint. This way the InputTextView will always fill the space inbetween in addition to providing methods that can easily be called to hide all buttons to the right or left of the InputTextView by setting the width constraint constant to 0. The bottom and top stack views are not height constraint and rely on their intrinsicContentSize

func setLeftStackViewWidthConstant(to newValue: CGFloat, animated: Bool)

func setRightStackViewWidthConstant(to newValue: CGFloat, animated: Bool)

Reactive Hooks

Each InputBarButtonItem has properties that can hold actions that will be executed during various hooks such as the button being touched, the UITextView text changing and more! Thanks to these easy hooks with a few lines of code the items can be easily resized and animated similar to that of the Facebook messenger app.

// MARK: - Hooks
    
public typealias InputBarButtonItemAction = ((InputBarButtonItem) -> Void)    
    
private var onTouchUpInsideAction: InputBarButtonItemAction?
private var onKeyboardEditingBeginsAction: InputBarButtonItemAction?
private var onKeyboardEditingEndsAction: InputBarButtonItemAction?
private var onKeyboardSwipeGestureAction: ((InputBarButtonItem, UISwipeGestureRecognizer) -> Void)?
private var onTextViewDidChangeAction: ((InputBarButtonItem, InputTextView) -> Void)?
private var onSelectedAction: InputBarButtonItemAction?
private var onDeselectedAction: InputBarButtonItemAction?
private var onEnabledAction: InputBarButtonItemAction?
private var onDisabledAction: InputBarButtonItemAction?

Author

Nathan Tannar - https://nathantannar.me Jakub Kaspar - https://jakubkaspar.dev

License

Distributed under the MIT license. See LICENSE for more information.

More Repositories

1

Transmission

Bridges UIKit presentation APIs to a SwiftUI API so you can use presentation controllers, interactive transitions and more.
Swift
413
star
2

Engine

Engine makes it easier to create idiomatic APIs and Views that feel natural in SwiftUI without sacrificing performance
Swift
173
star
3

TypingIndicator

A replica of iMessage's typing indicator bubble with support for a variety of animations
Swift
173
star
4

Parse-Dashboard-for-iOS

A beautiful mobile client for managing your Parse apps while you are on the go! Now you can easily view and modify your data in the same way you would on the offical desktop client.
Swift
100
star
5

Turbocharger

Turbocharger aims accelerate SwiftUI development by providing commonly desired views and view modifiers
Swift
70
star
6

DynamicTabBarController

An improved UITabBarController that is dynamic and has a scroll indicator line
Swift
39
star
7

the.phoenix.project

A deployment ready Vapor 3 API template with support for authentication, real-time chat, push notifications, files, email verification
Swift
32
star
8

Ignition

Ignition aims to help make your SwiftUI views feel more interactive. It does this by providing API that makes it easier to run animations.
Swift
22
star
9

MVVM-ViewInjection-Template

MVVM Template that utilizes RxSwift, Generics and more
Swift
14
star
10

NTComponents

An all in one framework for everything I find useful! Improved classes and extensions to accelerate development.
Swift
10
star
11

Safety-Beacon

Term project for CMPT 275: Software Engineering I
Swift
9
star
12

Engage

Engage was my first project utilizing Swift to create a social networking application. I have since removed it from the App Store and no longer work on it.
Swift
6
star
13

AlertHUDKit

A collection of alerts for toasting, pinging and progress messages
Swift
5
star
14

SwiftMiniProjects

Inspired by the many "30 Swift Projects" I thought it best to break create a single workspace and repo for all mini projects I start. These are not projects focused on building an app but rather classes built to be easily integratable with future apps.
Swift
4
star
15

UIKitExtension

UIPageTabBarController & UIDrawerController
Swift
2
star
16

NTToolKit

A collection of extensions I find helpful
Swift
2
star
17

nathantannar.me

My personal website build on top of Vapor using Swift
JavaScript
2
star
18

Contacts-RxSwift-Realm

A contact app using the MVVM architecture, RxSwift and RxCocoa.
Swift
2
star
19

StockApp

Just a simple stock app I threw together to learn SwiftStock and consume some external API information
Swift
2
star
20

StyleKit

Easily apply and keep track of color and font defaults. Includes predefined Google Material Design icons and colors as well as FontAwesome icons
Swift
2
star
21

WEC2018

Swift
1
star
22

ParseServer

A modified parse-server-example fork that I use
JavaScript
1
star
23

Count-on-Us

2016 SAP Hackathon
Swift
1
star
24

XModemFileTransfer

ENSC 351 XModem File Transfer Protocal in C++
C++
1
star
25

Afterburner

UIKit components wrapped in SwiftUI
Swift
1
star
26

VHDL-Code-Parser

Final Project for ENSC 251
C++
1
star
27

EM-2016

Website for the WESST Executives Meeting 2016
PHP
1
star
28

DormHub

Find roommates, places to rent and reviews. CMPT 354 - Database Systems 1 Project
JavaScript
1
star
29

VGA-Controller

A VHDL datapath I implemented to drive a VGA controller to print diagonal lines and triangles from an FPGA
Verilog
1
star
30

Xcode-Templates

1
star
31

WEC2017-Website-and-Delegate-Portal

JavaScript
1
star
32

NTKeyboard

Simple 3rd party keyboard for learning the basic functionality
Swift
1
star