https://github.com/cristinasitaa/bubbles
https://github.com/cristinasitaa/bubbles
animation animation-library apple-music bubbles ios picker swift swift-3
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cristinasitaa/bubbles
- Owner: cristinasitaa
- License: mit
- Created: 2017-04-11T16:07:03.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-08-29T12:40:19.000Z (over 6 years ago)
- Last Synced: 2025-04-09T23:53:04.075Z (11 months ago)
- Topics: animation, animation-library, apple-music, bubbles, ios, picker, swift, swift-3
- Language: Swift
- Size: 638 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bubbles
[](https://swift.org)
[](http://cocoapods.org/pods/Bubbles)
[](http://cocoapods.org/pods/Bubbles)
Bubbles is a great new iOS picker written in Swift introduced with the Apple Music App.

## Installation
Bubbles is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod "Bubbles"
```
## Requirements
- iOS 9.0+
- Xcode 8.0+
- Swift 3.0+
## Usage
To add a new Bubble picker, import Bubbles in your ViewController:
```swift
import Bubbles
```
Add a new view in your .XIB and set the class to ```CSBubblesView```
Change ```Primary Color``` and ```Secondary Color``` from the Attributes Inspector
Connect your new picker through an @IBOutlet
```swift
@IBOutlet weak var bubblesView: CSBubblesView!
```
Finally, in your ```viewDidAppear``` add the following
```swift
self.bubblesView.dataArray = NSMutableArray(array: ["Argentina", "Aruba", "Australia", "Austria", "Bahamas", "Barbados", "Belgium", "Belize", "Bermuda", "Brazil", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Dominican Republic", "Egypt", "Faroe Islands", "Fiji", "France", "Germany", "Greece"])
```
In order to retrive the values that were selected/deselected, use ```NSNotificationCenter```
Add in your ```viewDidLoad```
```swift
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.bubbleWasSelected), name: NSNotification.Name(rawValue: "BubbleWasSelected"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(ViewController.bubbleWasDeselected), name: NSNotification.Name(rawValue: "BubbleWasDeselected"), object: nil)
```
And implement the methods:
```swift
func bubbleWasSelected(notification: NSNotification) {
print(notification.object as! String)
}
func bubbleWasDeselected(notification: NSNotification) {
print(notification.object as! String)
}
```
## Author
Cristina Sita, cristinasitaa@gmail.com
## License
Bubbles is available under the MIT license. See the LICENSE file for more info.