Number Pad inspired by Square. This module is based on LEAmountInputView.
$ pod try NumPad
- iOS 9.0+
- Xcode 9.0+
- Swift 4 (NumPad 3.x), Swift 3 (NumPad 2.x), Swift 2.3 (NumPad 1.x)
To install with CocoaPods, simply add this in your Podfile
:
use_frameworks!
pod "NumPad"
To install with Carthage, simply add this in your Cartfile
:
github "efremidze/NumPad"
- Download and drop
NumPad.swift
in your project. - Congratulations!
Add NumPad
to your view.
import NumPad
let numPad = NumPad(frame: CGRect(x: 0, y: 0, width: 320, height: 600))
numPad.dataSource = self
numPad.delegate = self
addSubview(numPad)
Use the DefaultNumPad
for a preconfigured dataSource and delegate.
// number of rows
func numberOfRowsInNumPad(numPad: NumPad) -> Int
// number of columns for row
func numPad(numPad: NumPad, numberOfColumnsInRow row: Row) -> Int
// item for position
func numPad(numPad: NumPad, itemAtPosition position: Position) -> Item
// handle item tap
func numPad(numPad: NumPad, itemTapped item: Item, atPosition position: Position)
// item size for position
func numPad(numPad: NumPad, sizeForItemAtPosition position: Position) -> CGSize
Contributions are totally welcome.
NumPad is available under the MIT license. See the LICENSE file for more info.