Skip to content

An easy-to-use picker view built on UIKitDynamics which can be used for content picking for iOS

License

Notifications You must be signed in to change notification settings

ronneldavis/BubblePicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BubblePicker

CI Status Version License Platform

A similar library for Android made by Irina Galata can be found here

Bubble Picker GIF

Example

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

Upgrade Warning

Version 1.0 of this library has undergone a comeplete rewrite and will require significant changes to your codebase if you were using the previous version. It now uses a delegate based architecture rather than the previous version which required closures.

Requirements

BubblePicker requires a deployment target of atleast iOS 9.0 for UIKitDynamics and Swift 4.

Usage

Setup the BubblePicker view

let arr = ["TV Shows", "Sports", "Technology", "Science", "People", "Places", "Music", "Photography"]

bubblePicker = BubblePicker()       // Or use a storyboard
bubblePicker.delegate = self;
bubblePicker.reloadData();

Implement the delegate methods

extension ViewController: BubblePickerDelegate {

    func numberOfItems(in bubblepicker: BubblePicker) -> Int {
        return items.count;
    }

    func bubblePicker(_: BubblePicker, nodeFor indexPath: IndexPath) -> BubblePickerNode {
        let node = BubblePickerNode(title: items[indexPath.item], color: UIColor.red, image: UIImage());
        return node;
    }
}

Delegate callbacks for when a user selects or deselects a bubble

func bubblePicker(_: BubblePicker, didSelectNodeAt indexPath: IndexPath) {

}

func bubblePicker(_: BubblePicker, didDeselectNodeAt indexPath: IndexPath) {

}

Set and get selected nodes

bubblePicker.setSelected([0, 2, 3, 4]);
bubblePicker.getSelected();

Bubble picker node properties

public var font: UIFont = UIFont(name: "Avenir-Heavy", size: 14)!
public var selectedFont: UIFont = UIFont(name: "Avenir", size: 22)!
public var textColor: UIColor = UIColor.white

Installation

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

pod "BubblePicker"

Author

Ronnel Davis: [email protected]

License

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

Copyright (c) 2018 Ronnel Davis

About

An easy-to-use picker view built on UIKitDynamics which can be used for content picking for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published