blob: 69a73b467888e5d82ab5a907c1555ddc3b33a2f8 [file] [log] [blame]
{
"name": "KeyboardLayoutEngine",
"version": "0.8.4",
"summary": "⌨️ Simplest custom keyboard generator for iOS ever!",
"description": "KeyboardLayoutEngine\n===\n\n⌨️ Simplest custom keyboard generator for iOS ever!\n\n`KeyboardLayoutEngine` is all about laying out keyboard buttons dynamically in a rectangle in a custom style easily but in fashion of original keyboard. For the sake of flexiblity, KeyboardLayoutEngine provides:\n\n* `KeyboardLayout`: For laying out rows with custom paddings, colors.\n* `KeyboardRow`: For laying out buttons or another set of KeyboardRow's inside.\n* `KeyboardButton`: For rendering buttons in rows. Also provides flexible width, type and other very useful API's for flexiblty.\n* They are also `UIView`s and handles their layout in their `layoutSubviews` function.\n* They are faster than autolayout yet they can adopt perfectly any `CGFrame` you want apply a keyboard layout.\n* That means they are play very well with orientation changes. (Layout for size class and/or orientation support is on the way.)\n* `KeyboardLayoutStyle`, `KeyboardRowStyle` and `KeyboardButtonStyle` structs handles pretty much everything about styling.\n* `KeyboardLayoutDelegate` for inform about button presses.\n* Also `DefaultKeyboard` provided out of box, a good start point for figuring out how it works other than being of fully functional original keyboard.\n\nInstall\n----\n#### CocoaPods\n\n``` ruby\nuse_frameworks!\n# Target Keyboard\npod 'KeyboardLayoutEngine'\n```\n\nUsage\n----\n\n* Describe your keyboard with custom styles, rows and buttons with either text or image in it.\n* Checkout the [DefaultKeyboardLayout](https://github.com/cemolcay/KeyboardLayoutEngine/blob/master/Keyboard/DefaultKeyboard/DefaultKeyboardLayout.swift) for detailed usage.\n\n``` swift\nlet keyboardLayout = KeyboardLayout(\nstyle: DefaultKeyboardLayoutStyle,\nrows: [\nKeyboardRow(\nstyle: DefaultKeyboardRowStyle,\ncharacters: [\nKeyboardButton(type: .Key(\"Q\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"W\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"E\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"R\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"T\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"Y\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"U\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"I\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"O\"), style: DefaultKeyboardKeyButtonStyle),\nKeyboardButton(type: .Key(\"P\"), style: DefaultKeyboardKeyButtonStyle),\n]\n)\n]\n)\n\noverride func viewDidLoad() {\nsuper.viewDidLoad()\nview.addSubview(keyboardLayout)\n}\n\noverride func viewDidLayoutSubviews() {\nsuper.viewDidLayoutSubviews()\nkeyboardLayout.setNeedsLayout()\n}\n```\n\nKeyboardLayoutDelegate\n----\n\n* Implement `KeyboardLayoutDelegate` for get information about the button presses.\n\n``` swift\n@objc public protocol KeyboardLayoutDelegate {\noptional func keyboardLayoutDidStartPressingButton(keyboardLayout: KeyboardLayout, keyboardButton: KeyboardButton)\noptional func keyboardLayoutDidPressButton(keyboardLayout: KeyboardLayout, keyboardButton: KeyboardButton)\n}\n```\n\nKeyboardButtonWidth\n----\n\n``` swift\npublic enum KeyboardButtonWidth {\ncase Dynamic\ncase Static(width: CGFloat)\ncase Relative(percent: CGFloat)\n}\n```\n\n* Laying out buttons in rows are important. Since rows can their child rows, calculating right sizes for buttons and rows done by button types.\n* If you leave `.Dynamic` which is default by the way, every button in a row, it will calculate their width by `KeyboardRowStyle.buttonPadding` and total width of row and figure out equal widths with equal buttonPaddings.\n* Static will be static width obviusly.\n* Relative is an interesting one, which takes a value between [0, 1], fills percent of parent row, smartly calculated.\n\nKeyboardButtonType\n----\n\n``` swift\npublic enum KeyboardButtonType {\ncase Key(String)\ncase Text(String)\ncase Image(UIImage?)\n}\n```\n\n* A button can be `Key`, `Text` or `Image`.\n* Key case might be useful for `textDocumentProxy.insertText`operation.\n* Text case might be useful for buttons like \"space\", \"return\", \"ABC\", \"123\" or any string include emojis.\n* Image case might be useful for buttons like \"shift\", \"backspace\", \"switch keyboard\" etc.\n\nStyling\n----\n\n* Every style struct has their default values in taste of original keyboard.\n* If you dont assign a value in `init` function of a style struct, it will be loaded with its default value.\n\nKeyboardLayoutStyle\n----\nDefinition:\n\n``` swift\npublic struct KeyboardLayoutStyle {\npublic var topPadding: CGFloat\npublic var bottomPadding: CGFloat\npublic var rowPadding: CGFloat\npublic var backgroundColor: UIColor\n}\n```\n\nExample:\n\n``` swift\nlet DefaultKeyboardLayoutStyle = KeyboardLayoutStyle(\ntopPadding: 10,\nbottomPadding: 5,\nrowPadding: 13,\nbackgroundColor: UIColor(red: 208.0/255.0, green: 213.0/255.0, blue: 219.0/255.0, alpha: 1))\n```\n\nKeyboardRowStyle\n----\n\nDefinition:\n\n\n``` swift\npublic struct KeyboardRowStyle {\npublic var leadingPadding: CGFloat\npublic var trailingPadding: CGFloat\npublic var buttonsPadding: CGFloat\n}\n```\n\nExample:\n\n``` swift\nlet DefaultKeyboardRowStyle = KeyboardRowStyle(\nleadingPadding: 5,\ntrailingPadding: 5,\nbuttonsPadding: 6)\n```\n\nKeyboardButtonStyle\n----\n\nDefinition:\n\n``` swift\npublic struct KeyboardButtonStyle {\npublic var backgroundColor: UIColor\npublic var cornerRadius: CGFloat\n\n// Border\npublic var borderColor: UIColor\npublic var borderWidth: CGFloat\n\n// Shadow\npublic var shadowColor: UIColor\npublic var shadowOpacity: Float\npublic var shadowOffset: CGSize\npublic var shadowRadius: CGFloat\npublic var shadowPath: UIBezierPath?\n\n// Text\npublic var textColor: UIColor\npublic var font: UIFont\n\n// Image\npublic var imageSize: CGFloat?\n\n// Popup\npublic var showsPopup: Bool\npublic var popupWidthMultiplier: CGFloat\npublic var popupHeightMultiplier: CGFloat\n}\n```\n\nExample:\n\n``` swift\nlet DefaultKeyboardDarkImageButtonStyle = KeyboardButtonStyle(\nbackgroundColor: UIColor(red: 180.0/255.0, green: 188.0/255.0, blue: 201.0/255.0, alpha: 1),\nimageSize: 18,\nshowsPopup: false)\n```\n\nDefaultKeyboard\n----\n\nDefault iOS Keyboard implementation with `KeyboardLayoutEngine`.\n\n* Shift toggle mechanism\n* Backspace mechanisim\n* Key button popups\n* `textDocumentProxy` integrations with `DefaultKeyboardDelegate`\n* Ridiculusly easy implementation in `KeyboardViewController`\n* Change default styles before initilze it and you have your fully functional custumised standard English QWERTY keyboard!\n\n``` swift\noverride func viewDidLoad() {\nsuper.viewDidLoad()\nDefaultKeyboardLayoutStyle.backgroundColor = UIColor.redColor()\nDefaultKeyboardRowStyle.buttonsPadding = 5\ndefaultKeyboard = DefaultKeyboard()\ndefaultKeyboard.delegate = self\nview.addSubview(defaultKeyboard)\n}\n```\n\n#### DefaultKeyboard styles\n\n* DefaultKeyboardLayoutStyle: `KeyboardLayoutStyle`\n* DefaultKeyboardRowStyle: `KeyboardRowStyle`\n* DefaultKeyboardSecondRowStyle: `KeyboardRowStyle`\n* DefaultKeyboardChildRowStyle: `KeyboardRowStyle`\n* DefaultKeyboardSpaceButtonStyle: `KeyboardButtonStyle`\n* DefaultKeyboardBackspaceButtonStyle: `KeyboardButtonStyle`\n* DefaultKeyboardShiftButtonStyle: `KeyboardButtonStyle`\n* DefaultKeyboardGlobeButtonStyle: `KeyboardButtonStyle`\n* DefaultKeyboardReturnButtonStyle: `KeyboardButtonStyle`\n* DefaultKeyboardNumbersButtonStyle: `KeyboardButtonStyle`\n* DefaultKeyboardKeyButtonStyle: `KeyboardButtonStyle`\n\nDefaultKeyboardDelegate\n----\n\n* Provides information about key and special button presses.\n\n``` swift\n@objc public protocol DefaultKeyboardDelegate {\noptional func defaultKeyboardDidPressKeyButton(defaultKeyboard: DefaultKeyboard, key: String)\noptional func defaultKeyboardDidPressSpaceButton(defaultKeyboard: DefaultKeyboard)\noptional func defaultKeyboardDidPressBackspaceButton(defaultKeyboard: DefaultKeyboard)\noptional func defaultKeyboardDidPressGlobeButton(defaultKeyboard: DefaultKeyboard)\noptional func defaultKeyboardDidPressReturnButton(defaultKeyboard: DefaultKeyboard)\n}\n```",
"homepage": "https://github.com/cemolcay/KeyboardLayoutEngine",
"license": "MIT",
"authors": {
"cemolcay": "ccemolcay@gmail.com"
},
"platforms": {
"ios": "8.0"
},
"source": {
"git": "https://github.com/cemolcay/KeyboardLayoutEngine.git",
"tag": "0.8.4"
},
"source_files": [
"Keyboard/KeyboardLayoutEngine/*.swift",
"Keyboard/DefaultKeyboard/*.swift",
"Keyboard/KeyPop/*.swift"
],
"resources": "Keyboard/Resources.xcassets",
"frameworks": "UIKit",
"requires_arc": true,
"dependencies": {
"Shadow": [
],
"ManualLayout": [
]
}
}