- Also you can change some settings in BubbleConstants struct or play with some settings of UIDynamicBehaviors.
Bubble pickers, inspired by Apple
AmazingBubbles Library is available through CocoPods. To install, add the following line to your Podfile:
pod ‘AmazingBubbles’, ‘~> 0.0’
import AmazingBubbles
class ViewController: UIViewController {
@IBOutlet weak var bubblesView: ContentBubblesView! {
didSet {
bubblesView.delegate = self
bubblesView.dataSource = self
}
}
}
public protocol ContentBubblesViewDelegate: class {
func minimalSizeForBubble(in view: ContentBubblesView) -> CGSize
func maximumSizeForBubble(in view: ContentBubblesView) -> CGSize
func contentBubblesView(_ view: ContentBubblesView, didSelectItemAt index: Int)
func contentBubblesView(_ view: ContentBubblesView, shouldChangeSizeForItemAt index: Int) -> Bool
func contentBubblesView(_ view: ContentBubblesView, didChangeSizeForItemAt index: Int)
}
public protocol ContentBubblesViewDataSource: class {
func countOfSizes(in view: ContentBubblesView) -> Int
func numberOfItems(in view: ContentBubblesView) -> Int
func addOrUpdateBubbleView(forItemAt index: Int, currentView: BubbleView?) -> BubbleView
}
for example:
extension ViewController: ContentBubblesViewDataSource {
func countOfSizes(in view: ContentBubblesView) -> Int {
return 3
}
func numberOfItems(in view: ContentBubblesView) -> Int {
return 15
}
func addOrUpdateBubbleView(forItemAt index: Int, currentView: BubbleView?) -> BubbleView {
var view: BubbleView = currentView ?? BubbleView()
view.backgroundColor = .clear
let randomOrigin = CGPoint(x: CGFloat(drand48() * Double(self.view.frame.width * 2 / 3)),
y: CGFloat(drand48() * Double(self.view.frame.height * 2 / 3)))
view.frame = CGRect(origin: randomOrigin,
size: .zero)
return view
}
}
bubblesView.reload(randomizePosition: true)
bubblesView.tapEnabled = true
bubblesView.panEnabled = false
This package provides you with an easy way to show tooltips over any SwiftUI view, since Apple does not provide ...
SimpleToast is a simple, lightweight, flexible and easy to use library to show toasts / popup notifications inside iOS or ...
Create Toast Views with Minimal Effort in SwiftUI Using SSToastMessage. SSToastMessage enables you to effortlessly add toast notifications, alerts, and ...