https://github.com/meta-ben/swifttoolboard
Swift framework to add a toolbar above the keyboard
https://github.com/meta-ben/swifttoolboard
ios plugin swift
Last synced: 8 months ago
JSON representation
Swift framework to add a toolbar above the keyboard
- Host: GitHub
- URL: https://github.com/meta-ben/swifttoolboard
- Owner: Meta-Ben
- License: gpl-3.0
- Created: 2018-02-04T17:30:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-15T22:46:56.000Z (almost 2 years ago)
- Last Synced: 2025-08-01T03:51:56.028Z (10 months ago)
- Topics: ios, plugin, swift
- Language: Swift
- Homepage:
- Size: 56.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
:iphone: SwiftToolBoard :iphone:
Swift framework to add a toolbar above the keyboard
## Preview
Preview broken
How to install
Add this line into your Podfile
```
pod 'SwiftToolBoard', :git => 'https://github.com/Happeal/SwiftToolBoard.git'
```
then run `pod install`
After that go in your project and launch `Product -> Build` to add the framework into your project
How to use
start by adding `import SwiftToolBoard`
then, you can instantiate the `ToolBoard`
Use exemple :
```swift
import UIKit
import SwiftToolBoard
class ViewController : UIViewController {
@IBOutlet weak var myTextBox : UITextField!
override func viewDidLoad() {
super.viewDidLoad()
let tB = ToolBoard()
tB.changeItemNumber(number: 20)
myTextBox.inputAccessoryView = tB
}
}
```
There is 3 constructor :
```swift
//Instantiate without item and with all default param
let tB = ToolBoard()
//Instantiate with 20 item
let tB = ToolBoard(itemNumber : 20)
//Instantiate the toolboard with 20 item and a specific cell create by you
let tB = ToolBoard(itemNumber : 20, cellNibName: "MyCellView", reuseCellIdentifier: "myCellReuseId")
```
You can use many function to change the toolboard you can create whatever you want ( even a form into the keyboard like an option menu with button into cells )
How to implement delegate methods
There is two delegate method to implement : ( Exemple )
before you need to tell that the controller is the delegate
```swift
override func viewDidLoad() {
//viewDidLoad code
let tB = ToolBoard()
tB.delegate = self
//viewDidLoad code
}
```
when its done you need to extend your controller like this :
```swift
extension ViewController: ToolBoardDelegate {
func toolBoard(_ toolBoard: ToolBoard, cellForItem cell: UICollectionViewCell, indexPath : IndexPath) {
//Put here you're code ( this method will be call every time the collectionView into the toolboard iterate on these cell )
}
func toolBoard(_ toolBoard: ToolBoard, didSelectObject index : Int){
//Put here you're code ( this method will be call every time the user touch a cell )
}
}
```
Enjoy !! :)