All Projects → futuredapp → Tfbubbleitup

futuredapp / Tfbubbleitup

Licence: mit
Custom view for writing tags, contacts and etc. - written in Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Tfbubbleitup

RegulatorView
Intelligent furniture remote control
Stars: ✭ 20 (-93.99%)
Mutual labels:  control
jquery-rsSliderLens
UI slider control that magnifies the current value
Stars: ✭ 20 (-93.99%)
Mutual labels:  control
Seo Helper
🔍 SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization).
Stars: ✭ 262 (-21.32%)
Mutual labels:  tags
granblue-automation-android
Educational application written in Kotlin aimed at automating user-defined workflows for the mobile game, "Granblue Fantasy", using MediaProjection, AccessibilityService, and OpenCV.
Stars: ✭ 26 (-92.19%)
Mutual labels:  control
hoverboard-firmware-hack-FOC
With Field Oriented Control (FOC)
Stars: ✭ 400 (+20.12%)
Mutual labels:  control
guess-filename.py
Derive a file name according to old file name cues and/or PDF file content
Stars: ✭ 27 (-91.89%)
Mutual labels:  tags
Modiy
Modiy is an open-source hardware interface for modular synthesis.
Stars: ✭ 21 (-93.69%)
Mutual labels:  control
Tensorforce
Tensorforce: a TensorFlow library for applied reinforcement learning
Stars: ✭ 3,062 (+819.52%)
Mutual labels:  control
eva3
Industrial/Enterprise and home IoT automation platform
Stars: ✭ 27 (-91.89%)
Mutual labels:  control
Pyadvancedcontrol
Python codes for advanced control
Stars: ✭ 256 (-23.12%)
Mutual labels:  control
neos-blog
A simple blog plugin for Neos CMS
Stars: ✭ 17 (-94.89%)
Mutual labels:  tags
ebsautotagger
AWS Lambda function to tag EBS volumes created by autoscaling
Stars: ✭ 18 (-94.59%)
Mutual labels:  tags
RobustAndOptimalControl.jl
Robust and optimal design and analysis of linear control systems
Stars: ✭ 25 (-92.49%)
Mutual labels:  control
go-csv-tag
Read csv file from go using tags
Stars: ✭ 94 (-71.77%)
Mutual labels:  tags
Free gait
An Architecture for the Versatile Control of Legged Robots
Stars: ✭ 263 (-21.02%)
Mutual labels:  control
smart-tagz
🏷Smart input tags for Vue
Stars: ✭ 28 (-91.59%)
Mutual labels:  tags
osqp
The Operator Splitting QP Solver
Stars: ✭ 929 (+178.98%)
Mutual labels:  control
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.
Stars: ✭ 305 (-8.41%)
Mutual labels:  control
Drq
DrQ: Data regularized Q
Stars: ✭ 268 (-19.52%)
Mutual labels:  control
Ddnsto
DDNSTO 文档以及问题反馈。
Stars: ✭ 255 (-23.42%)
Mutual labels:  control
TFBubbleItUp logo

TFBubbleItUp

Version License Platform

preview

Usage

Just place UIView in your controller wherever you want and make it as TFBubbleItUpView subclass. It is configured as IBDesignable, so it will show up. The content size is calculated by the view itself, no need to use height constraint. Just set in the Interface builder Intrinsic size to placeholder - width check None and for height choose what suits you best.

Intrinsic size

There is also a delegate available (named bubbleItUpDelegate, because TFBubbleItUpView is in fact a subclass of UICollectionView) with currently one method func bubbleItUpViewDidFinishEditingBubble(view: TFBubbleItUpView, text: String).

You can preset values with setItem([TFBubbleItem]) where TFBubbleItem is a struct whose initializer takes string (TFBubbleItem(text: "Hullo!")).

If you want to access all items from view, there is method for that validStrings() -> [String]. That's because sometimes there are empty items, this method will filter it for you a send you only valid strings.

Validation

Among all the configuration, there is an ability to validate items before they can be bubbled. There is typealias named Validation which is just a function definition:

public typealias Validation = String -> Bool

Verification function takes a string and returns Bool indicates whether the string is valid or not. These methods should be elementary. There are already two of them available as public classes of TFBubbleItUpValidation - testEmptiness() and testEmailAddress(). These methods returns Validation function and the validation can be called like testEmptiness()("a text"). This technique of translating the evaluation of a function is called Currying. You can provide your own Validation:

func testSomething() -> Validation {
  return { text in
    return text == "something"
  }
}

This allows us to easily combine validation by function TFBubbleItUpValidation.combine(v1: Validation, v2: Validation) or even better with provided operator |>>

let validation = TFBubbleItUpValidation.testEmptiness() |>> TFBubbleItUpValidation.testEmailAddress()

The validation can be applied to TFBubbleItUpView via configuration

TFBubbleItUpViewConfiguration.itemValidation = validation

And we can also validate the maximum number of items user can type in by

TFBubbleItUpViewConfiguration.numberOfItems = .Quantity(5) // default .Unlimited

Configuration

BubbleItUp is highly configurable. There is configuration file called TFBubbleItUpViewConfiguration with class variables for configuration.

It is a mix of appearance and functional stuff. I would like to point out skipOnWhitespace and skipOnReturnKey properties, by them you can change the behaviour of bubble creation around text (see documentation comments bellow).

/// Background color for cell in normal state
public static var viewBackgroundColor: UIColor = UIColor(red: 0.918, green: 0.933, blue: 0.949, alpha: 1.00)

/// Background color for cell in edit state
public static var editBackgroundColor: UIColor = UIColor.whiteColor()

/// Background color for cell in invalid state
public static var invalidBackgroundColor: UIColor = UIColor.whiteColor()

/// Font for cell in normal state
public static var viewFont: UIFont = UIFont.systemFontOfSize(12.0)

/// Font for cell in edit state
public static var editFont: UIFont = UIFont.systemFontOfSize(12.0)

/// Font for cell in invalid state
public static var invalidFont: UIFont = UIFont.systemFontOfSize(12.0)

/// Font color for cell in view state
public static var viewFontColor: UIColor = UIColor(red: 0.353, green: 0.388, blue: 0.431, alpha: 1.00)

/// Font color for cell in edit state
public static var editFontColor: UIColor = UIColor(red: 0.510, green: 0.553, blue: 0.596, alpha: 1.00)

/// Font color for cell in invalid state
public static var invalidFontColor: UIColor = UIColor(red: 0.510, green: 0.553, blue: 0.596, alpha: 1.00)

/// Corner radius for cell in view state
public static var viewCornerRadius: Float = 2.0

/// Corner radius for cell in edit state
public static var editCornerRadius: Float = 2.0

/// Corner radius for cell in invalid state
public static var invalidCornerRadius: Float = 2.0

/// Height for item
public static var cellHeight: Float = 25.0

/// View insets
public static var inset: UIEdgeInsets = UIEdgeInsetsMake(5, 5, 5, 5)

/// Interitem spacing
public static var interitemSpacing: CGFloat = 5.0

/// Line spacing
public static var lineSpacing: CGFloat = 5.0

/// Keyboard type
public static var keyboardType: UIKeyboardType = UIKeyboardType.EmailAddress

/// Keyboard return key
public static var returnKey: UIReturnKeyType = UIReturnKeyType.Done

/// Field auto-capitalization type
public static var autoCapitalization: UITextAutocapitalizationType = UITextAutocapitalizationType.None

/// Field auto-correction type
public static var autoCorrection: UITextAutocorrectionType = UITextAutocorrectionType.No

/// If true it creates new item when user types whitespace
public static var skipOnWhitespace: Bool = true

/// If true it creates new item when user press the keyboards return key. Otherwise resigns first responder
public static var skipOnReturnKey: Bool = false

/// Number of items that could be written
public static var numberOfItems: NumberOfItems = .Unlimited

/// Item has to pass validation before it can be bubbled
public static var itemValidation: Validation? = nil

Requirements

TFBubbleItUp uses Swift 5.0. Target deployment iOS 10.0 and higher.

Installation

TFBubbleItUp is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TFBubbleItUp"

Author

Ales Kocur, [email protected]

License

TFBubbleItUp is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].