{"id":15293616,"url":"https://github.com/daltron/keyboardspy","last_synced_at":"2025-04-13T14:07:50.127Z","repository":{"id":56917880,"uuid":"81522147","full_name":"Daltron/KeyboardSpy","owner":"Daltron","description":"The Easiest Way to Observe Keyboard Notifications in iOS","archived":false,"fork":false,"pushed_at":"2017-09-26T13:52:16.000Z","size":1819,"stargazers_count":10,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T14:07:44.266Z","etag":null,"topics":["ios","ios-keyboard","ios-keyboardmanager","swift","swift3"],"latest_commit_sha":null,"homepage":null,"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/Daltron.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":"2017-02-10T03:26:46.000Z","updated_at":"2024-08-02T01:43:36.000Z","dependencies_parsed_at":"2022-08-21T03:50:55.458Z","dependency_job_id":null,"html_url":"https://github.com/Daltron/KeyboardSpy","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daltron%2FKeyboardSpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daltron%2FKeyboardSpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daltron%2FKeyboardSpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daltron%2FKeyboardSpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Daltron","download_url":"https://codeload.github.com/Daltron/KeyboardSpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724635,"owners_count":21151561,"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":["ios","ios-keyboard","ios-keyboardmanager","swift","swift3"],"created_at":"2024-09-30T16:50:11.792Z","updated_at":"2025-04-13T14:07:50.104Z","avatar_url":"https://github.com/Daltron.png","language":"Swift","readme":"![KeyboardSpy](https://raw.githubusercontent.com/Daltron/KeyboardSpy/master/KeyboardSpy/Assets/keyboard_spy.png)\n\n[![Version](https://img.shields.io/cocoapods/v/Spartan.svg?style=flat)](http://cocoapods.org/pods/KeyboardSpy)\n\u003ca href=\"https://developer.apple.com/swift\"\u003e\u003cimg src=\"https://img.shields.io/badge/swift-4.0-4BC51D.svg?style=flat\" alt=\"Language: Swift\" /\u003e\u003c/a\u003e\n[![Platform](https://img.shields.io/cocoapods/p/KeyboardSpy.svg?style=flat)](http://cocoapods.org/pods/KeyboardSpy)\n[![License](https://img.shields.io/cocoapods/l/KeyboardSpy.svg?style=flat)](http://cocoapods.org/pods/KeyboardSpy)\n\n### Written in Swift 4\n\nKeyboardSpy is a super lightweight and easy to use wrapper that makes observing keyboard notifications in iOS a breeze.\n\n## Requirements\n\n - iOS 8.0+\n - xCode 9.0+\n\n## Installation\n\n### CocoaPods\n\nTo integrate KeyboardSpy into your xCode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'KeyboardSpy'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n## Usage\n\nKeyboardSpy uses a protocol based approach to observe keyboard notifications:\n\n```swift\npublic protocol KeyboardSpyAgent {\n    var keyboardEventsToSpyOn: [KeyboardSpyEvent] { get }\n    func keyboardSpyEventProcessed(event:KeyboardSpyEvent, keyboardInfo: KeyboardSpyInfo)\n}\n```\n\nTo add a spy, simply:\n\n```swift\nKeyboardSpy.spy(on: self)\n```\n\nTo remove a spy, simply:\n\n```swift\nKeyboardSpy.unspy(on: self)\n```\n\nThere are six different events you can spy on:\n\n```swift\npublic enum KeyboardSpyEvent {\n    case willShow\n    case didShow\n    case willHide\n    case didHide\n    case willChangeFrame\n    case didChangeFrame\n}\n```\n\nYou will get the following object for each event you spy on:\n\n```swift\npublic class KeyboardSpyInfo: NSObject {\n    public private(set) var beginFrame: CGRect!\n    public private(set) var endFrame: CGRect!\n    public private(set) var animationCurve: UIViewAnimationCurve!\n    public private(set) var animationDuration: Double!\n    public private(set) var isLocal: Bool!\n    public var keyboardHeight: CGFloat\n}\n```\n\n### Example:\n\n```swift\nimport KeyboardSpy\n\nclass KeyboardSpyViewController: UIViewController {\n    \n    override func viewWillAppear(_ animated: Bool) {\n        super.viewWillAppear(animated)\n        KeyboardSpy.spy(on: keyboardSpyView) // This can be placed anywhere\n    }\n    \n    override func viewWillDisappear(_ animated: Bool) {\n        super.viewWillDisappear(animated)\n        KeyboardSpy.unspy(on: keyboardSpyView) // This can be placed anywhere\n    }\n    \n}\n\nextension KeyboardSpyViewController: KeyboardSpyAgent {\n    \n    internal var keyboardEventsToSpyOn: [KeyboardSpyEvent] {\n    \treturn [.willShow, .willHide]\n    }\n    \n    internal func keyboardSpyEventProcessed(event: KeyboardSpyEvent, keyboardInfo: KeyboardSpyInfo) {\n        if event == .willShow {\n        \t// Do something like moving a view above the keyboard\n        } else if event == .willHide {\n        \t// Do something like moving a view back to its original position\n        }   \n    }\n\n}\n```\n\n## Author\n\nDalton Hinterscher, daltonhint4@gmail.com\n\n## License\n\nKeyboardSpy is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaltron%2Fkeyboardspy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaltron%2Fkeyboardspy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaltron%2Fkeyboardspy/lists"}