# Floaty
**Repository Path**: WWDC14/Floaty
## Basic Information
- **Project Name**: Floaty
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-03-14
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Floaty

[](https://cocoapods.org/pods/floaty)
[](https://cocoapods.org/pods/floaty)
[](https://cocoapods.org/pods/floaty)
[](https://travis-ci.org/kciter/Floaty)
Floaty is simple floating action button for iOS. (formerly KCFloatingActionButton)
> Why change the name?
> 1. Follow the swift naming convention.
> 2. `KCFloatingActionButton` is too long.
## Preview
## Requirements
* iOS 10.0+
* Swift 5.0
## Installation
### CocoaPods
```ruby
use_frameworks!
pod 'Floaty', '~> 4.2.0'
```
### Carthage
```ruby
github "kciter/Floaty"
```
### Swift Package Manager
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the dependencies value of your `Package.swift`.
```swift
dependencies: [
.package(url: "https://github.com/kciter/Floaty.git", from: "4.2.1")
]
```
### Manually
To install manually the Floaty in an app, just drag the `Floaty/*.swift` file into your project.
## Usage
### Storyboard support
### Dependent on the UIWindow.
```swift
Floaty.global.button.addItem(title: "Hello, World!")
Floaty.global.show()
```
### Dependent on the UIViewController.
```swift
let floaty = Floaty()
floaty.addItem(title: "Hello, World!")
self.view.addSubview(floaty)
```
### Use icon
```swift
let floaty = Floaty()
floaty.addItem("Hello, World!", icon: UIImage(named: "icon")!)
self.view.addSubview(floaty)
```
### Use handler
#### Swift
```swift
let floaty = Floaty()
floaty.addItem("I got a handler", icon: UIImage(named: "icon")!, handler: { item in
let alert = UIAlertController(title: "Hey", message: "I'm hungry...", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Me too", style: .default, handler: nil))
self.present(alert, animated: true, completion: nil)
floaty.close()
})
self.view.addSubview(floaty)
```
### Use custom item
```swift
let item = FloatyItem()
item.buttonColor = UIColor.blueColor()
item.title = "Custom item"
Floaty.global.button.addItem(item: item)
```
### RTL Support
You can use the `rtlMode` property to mirror the Floaty Button for rtl languages.
```swift
Floaty.global.rtlMode = true
```
### Sticky
You can use the `sticky` property.
```swift
floaty.sticky = true // sticking to parent UIScrollView(also UITableView, UICollectionView)
scrollView.addSubview(floaty)
```
### Friendly Tap
You can use the `friendlyTap` property.
```swifty
fab.friendlyTap = true
scrollView.addSubview(fab)
```
With the default location of the frame, the button is now tappable until the right and rightbottom of the screen. This prevents tapping behind it by accident.
### Animation type
| Pop | Fade | Slide Left |
|---|---|---|
![]() |
![]() |
![]() |
| Slide Up | None | |
![]() |
![]() |