Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takecian/SwiftShareBubbles
Animated Social share buttons control for iOS written in Swift
https://github.com/takecian/SwiftShareBubbles
Last synced: 10 days ago
JSON representation
Animated Social share buttons control for iOS written in Swift
- Host: GitHub
- URL: https://github.com/takecian/SwiftShareBubbles
- Owner: takecian
- License: other
- Created: 2017-03-10T08:14:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-22T03:01:24.000Z (over 2 years ago)
- Last Synced: 2024-10-04T10:46:15.941Z (about 1 month ago)
- Language: Swift
- Size: 445 KB
- Stars: 174
- Watchers: 8
- Forks: 18
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-swift - SwiftShareBubbles - Animated social share buttons control for iOS. (Libs / UI)
- awesome-swift - SwiftShareBubbles - Animated social share buttons control for iOS. (Libs / UI)
- awesome-swift - SwiftShareBubbles - Animated Social share buttons control for iOS written in Swift ` 📝 2 years ago` (UI [🔝](#readme))
- awesome-swift - SwiftShareBubbles - Animated social share buttons control for iOS. (Libs / UI)
README
# SwiftShareBubbles
[![Version](https://img.shields.io/cocoapods/v/SwiftRoutes.svg?style=flat)](http://cocoapods.org/pods/SwiftShareBubbles)
[![License](https://img.shields.io/cocoapods/l/SwiftRoutes.svg?style=flat)](http://cocoapods.org/pods/SwiftShareBubbles)
[![Platform](https://img.shields.io/cocoapods/p/SwiftRoutes.svg?style=flat)](http://cocoapods.org/pods/SwiftShareBubbles)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Bitrise](https://app.bitrise.io/app/aaadb7c63762126a/status.svg?token=F4r6DcltQqync0tJ1H_A1Q&branch=master)](https://www.bitrise.io)
[![codebeat badge](https://codebeat.co/badges/2fdcdba7-d711-44f7-8a61-e2112aec06dc)](https://codebeat.co/projects/github-com-takecian-swiftsharebubbles-master)Animated Social share buttons control for iOS written in Swift.
This library is inspired [AAShareBubbles](https://github.com/mixdesign/AAShareBubbles).![ShareBubbles1](./Resource/ShareBubbles1.gif)
I tried AAShareBubbles with Swift, it mostly worked. But I cannot use AAShareBubbles(Objective-c code) in protocol extension. So I created SwiftShareBubbles in pure Swift.
## Requirements
iOS 8.0 or later, written in Swift.
## Installation
### Cocoapods
```ruby
pod 'SwiftShareBubbles'
```### Carthage
SwiftRoutes is compatible with [Carthage](https://github.com/Carthage/Carthage). Add it to your `Cartfile`:
```ruby
github "takecian/SwiftShareBubbles"
```## Usage
1. Instantiate SwiftShareBubbles, specify center position and radius of Circle.
1. Choose social buttons to be shown.
1. Set delegate
1. Call show method.```swift
class ViewController: UIViewController, SwiftShareBubblesDelegate {var bubbles: SwiftShareBubbles?
override func viewDidLoad() {
super.viewDidLoad()
bubbles = SwiftShareBubbles(point: CGPoint(x: view.frame.width / 2, y: view.frame.height / 2), radius: 100, in: view)
bubbles?.showBubbleTypes = [Bubble.twitter, Bubble.line, Bubble.safari]
bubbles?.delegate = self
}// SwiftShareBubblesDelegate
func bubblesTapped(bubbles: SwiftShareBubbles, bubbleId: Int) {
if let bubble = Bubble(rawValue: bubbleId) {
print("\(bubble)")
switch bubble {
case .facebook:
break
case .twitter:
if SLComposeViewController.isAvailable(forServiceType: SLServiceTypeTwitter) {
guard let composer = SLComposeViewController(forServiceType: SLServiceTypeTwitter) else { return }
composer.setInitialText("test test")
present(composer, animated: true, completion: nil)
}
break
case .line:
break
default:
break
}
} else {
// custom case
}
}func bubblesDidHide(bubbles: SwiftShareBubbles) {
}@IBAction func buttonTapped(_ sender: Any) {
bubbles?.show()
}
}```
![ShareBubbles2](./Resource/ShareBubbles2.gif)
## Supported buttons
* LINE
* google plus
* Youtube
* Pintereset
* Safari## Custom icons
You can add custom icons as follows,
```swift
class ViewController: UIViewController, SwiftShareBubblesDelegate {var bubbles: SwiftShareBubbles?
let customBubbleId = 100
override func viewDidLoad() {
super.viewDidLoad()
...
let customAttribute = ShareAttirbute(bubbleId: customBubbleId, icon: UIImage(named: "Custom")!, backgroundColor: UIColor.white)
bubbles?.customBubbleAttributes = [customAttribute]
bubbles?.delegate = self
}func bubblesTapped(bubbles: SwiftShareBubbles, bubbleId: Int) {
if customBubbleId == bubbleId {
// custom case
print("custom tapped")
}
}
}
```## License
MIT