{"id":15160667,"url":"https://github.com/chongzone/keenkeyboard","last_synced_at":"2025-10-24T18:32:17.974Z","repository":{"id":53549522,"uuid":"414550962","full_name":"chongzone/KeenKeyboard","owner":"chongzone","description":"自定义安全键盘, 一行代码即可接入, 对业务无侵入, 支持数字、金额、身份证等常见样式","archived":false,"fork":false,"pushed_at":"2021-10-26T01:57:14.000Z","size":4110,"stargazers_count":7,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-29T23:55:32.601Z","etag":null,"topics":["keyboard","keyboards","objective-c","swift","xcode"],"latest_commit_sha":null,"homepage":"https://github.com/chongzone/KeenKeyboard.git","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chongzone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-07T10:10:43.000Z","updated_at":"2023-02-14T06:11:07.000Z","dependencies_parsed_at":"2022-09-12T21:14:09.096Z","dependency_job_id":null,"html_url":"https://github.com/chongzone/KeenKeyboard","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chongzone%2FKeenKeyboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chongzone%2FKeenKeyboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chongzone%2FKeenKeyboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chongzone%2FKeenKeyboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chongzone","download_url":"https://codeload.github.com/chongzone/KeenKeyboard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238024443,"owners_count":19403837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keyboard","keyboards","objective-c","swift","xcode"],"created_at":"2024-09-26T23:05:10.888Z","updated_at":"2025-10-24T18:32:09.099Z","avatar_url":"https://github.com/chongzone.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![KeenKeyboard](https://raw.githubusercontent.com/chongzone/KeenKeyboard/master/Resources/KeenKeyboardLogo.png)\n\n![CI Status](https://img.shields.io/travis/chongzone/KeenKeyboard.svg?style=flat)\n![](https://img.shields.io/badge/swift-5.0%2B-orange.svg?style=flat)\n![](https://img.shields.io/badge/pod-v1.0.2-brightgreen.svg?style=flat)\n![](https://img.shields.io/badge/platform-iOS-orange.svg?style=flat)\n![](https://img.shields.io/badge/license-MIT-blue.svg)\n\n## 效果样式 \n\n样式说明 | Gif 图 |\n----|------|\n数字键盘 |  \u003cimg src=\"https://raw.githubusercontent.com/chongzone/KeenKeyboard/master/Resources/Keyboard_01.gif\" width=\"318\" height=\"315\"\u003e |\n数字键盘2 |  \u003cimg src=\"https://raw.githubusercontent.com/chongzone/KeenKeyboard/master/Resources/Keyboard_02.gif\" width=\"318\" height=\"315\"\u003e |\n数字键盘3 |  \u003cimg src=\"https://raw.githubusercontent.com/chongzone/KeenKeyboard/master/Resources/Keyboard_03.gif\" width=\"318\" height=\"315\"\u003e |\n金额键盘 |  \u003cimg src=\"https://raw.githubusercontent.com/chongzone/KeenKeyboard/master/Resources/Keyboard_04.gif\" width=\"318\" height=\"315\"\u003e |\n身份证键盘 |  \u003cimg src=\"https://raw.githubusercontent.com/chongzone/KeenKeyboard/master/Resources/Keyboard_05.gif\" width=\"318\" height=\"315\"\u003e |\n\n## API 说明\n\n- [x] 自定义安全键盘, 支持数字、金额、身份证等常见的键盘样式等 \n- [x] 一行代码即可接入, 对业务无侵入，可针对不同场景按需配置其属性参数\n\n支持的键盘样式\n```ruby\nenum Style {\n    /// 数字样式\n    case number\n    /// 金额样式 数字 \u0026 小数点\n    case decimal\n    /// 身份证样式 数字 \u0026 X\n    case identityCard\n}\n```\n\n支持的布局样式\n```ruby\nenum LayoutMode {\n    /// 分割线\n    case separator\n    /// 固定(间隔固定 等分布局)\n    case fixed\n}\n```\n\n在属性参数对象 `KeenKeyboardAtrributes` 中可查看支持定制的参数属性\n```ruby\n// ...\n\n/// 样式  默认 number\npublic var style: KeenKeyboardAtrributes.Style = .number\n/// 布局样式 默认 fixed\npublic var layout: KeenKeyboardAtrributes.LayoutMode = .fixed\n\n/// 数值是否随机 默认 false\npublic var displayRandom: Bool = false\n/// 键盘高度 默认 X 系列键盘距离其安全区域底部高度为 34\npublic var keyboardHeight: CGFloat = 216 + .safeAreaBottomHeight\n\n/// 控件间隔 默认 6pt 仅对 fixed 布局生效\npublic var itemSpacing: CGFloat = 6\n/// 控件圆角 默认 5pt 仅对 fixed 布局生效\npublic var itemRadius: CGFloat = 5\n/// 阴影颜色 默认 #848688 仅对 fixed 布局生效\npublic var itemShadowColor: UIColor = UIColor.color(hexString: \"#848688\")\n/// 阴影透明度 默认 0.15 仅对 fixed 布局生效\npublic var itemShadowOpacity: Float = 0.15\n\n/// 分割线的大小 默认 0.5 pt 仅对 separator 布局生效\npublic var separatorScale: CGFloat = 0.5\n/// 分割线的颜色 默认 #EFEFEF 仅对 separator 布局生效\npublic var separatorColor: UIColor = UIColor.color(hexString: \"#EFEFEF\")\n\n/// 字体 默认系统 medium  24pt\npublic var titleFont: UIFont = UIFont.systemFont(ofSize: 24, weight: .medium)\n/// 颜色 默认 #333333\npublic var titleColor: UIColor = UIColor.color(hexString: \"#333333\")\n/// 高亮颜色  默认 #151515\npublic var titleHighlightedColor: UIColor = UIColor.color(hexString: \"#151515\")\n/// 背景色 默认 #FFFFFF\npublic var titleBackColor: UIColor = UIColor.color(hexString: \"#FFFFFF\")\n/// 高亮时背景色  默认 #E6E6E6\npublic var titleHighlightedBackColor: UIColor = UIColor.color(hexString: \"#E6E6E6\")\n\n// ...\n```\n\n在属性参数对象 `KeenAccessoryAtrributes` 中可查看支持定制的参数属性\n```ruby\n// ...\n\n/// 是否添加阴影 默认 false\npublic var showShadow: Bool = false\n/// 阴影颜色 默认 #848688\npublic var shadowColor: UIColor = UIColor.color(hexString: \"#848688\")\n/// 阴影透明度 默认 0.15\npublic var shadowOpacity: Float = 0.15\n\n// ...\n\n/// 标题\npublic var title: String = \"KEEN安全键盘\"\n/// 标题字体 默认常规 15pt\npublic var titleFont: UIFont = UIFont.systemFont(ofSize: 15, weight: .regular)\n/// 标题颜色 默认 #666666\npublic var titleColor: UIColor = UIColor.color(hexString: \"#666666\")\n\n// ...\n```\n\n## 使用介绍\n\n### `KeenKeyboard` 示例\n\n```ruby\nlet field = UITextField(frame: xxx)\n    .backColor(.orange)\n    .addViewTo(view)\n\n/// 方式 1 绑定自定义键盘\nKeenKeyboard.bindCustomKeyboard(field: field, delegate: self)\n\n/// 方式 2 绑定自定义键盘\nfield.bindCustomKeyboard(delegate: self)\n```\n\n### `KeenKeyboardDelegate` 代理\n\n```ruby\n/// 输入事件\nfunc insert(_ keyboard: KeenKeyboard, text: String)\n\n/// 删除事件\nfunc delete(_ keyboard: KeenKeyboard, text: String)\n\n/// 其他事件 仅对 number 样式生效\nfunc other(_ keyboard: KeenKeyboard, text: String)\n\n/// 属性参数 不设置取默认值\n/// - Returns: 属性对象\nfunc attributesOfKeyboard(for keyboard: KeenKeyboard) -\u003e KeenKeyboardAtrributes\n```\n\u003e 具体可下载查看源码实现 \n\n### `KeenAccessoryView` 示例\n\n```ruby\n/// 方式 1 绑定键盘附件 View\nKeenAccessoryView.bindAccessoryView(height: 45, delegate: self, field: field)\n\n/// 方式 2 绑定键盘附件 View\nfield.bindAccessoryView(height: 45, delegate: self)\n```\n\n### `KeenAccessoryViewDelegate` 代理\n\n```ruby\n/// 属性参数 不设置取默认值\n/// - Returns: 属性对象\nfunc attributesOfAccessoryView(for accessoryView: KeenAccessoryView) -\u003e KeenAccessoryAtrributes\n\n/// 回调事件 优先级高于闭包回调\nfunc complete(_ accessoryView: KeenAccessoryView)\n```\n\u003e 具体可下载查看源码实现 \n\n## 安装方式 \n\n### CocoaPods\n\n```ruby\nplatform :ios, '9.0'\nuse_frameworks!\n\ntarget 'TargetName' do\n\npod 'KeenKeyboard'\n\nend\n```\n\u003e `iOS` 版本要求 `9.0+`\n\u003e `Swift` 版本要求 `5.0+`\n\n## Contact Me\n\nQQ: 2209868966\n邮箱: chongzone@163.com\n\n\u003e 若在使用过程中遇到什么问题, 请 `issues` 我, 看到之后会尽快修复 \n\n## License\n\nKeenKeyboard is available under the MIT license. [See the LICENSE](https://github.com/chongzone/KeenKeyboard/blob/main/LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchongzone%2Fkeenkeyboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchongzone%2Fkeenkeyboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchongzone%2Fkeenkeyboard/lists"}