{"id":26465515,"url":"https://github.com/amerhukic/orientationtracker","last_synced_at":"2026-03-09T15:02:04.057Z","repository":{"id":56921213,"uuid":"170584403","full_name":"amerhukic/OrientationTracker","owner":"amerhukic","description":"Track device orientation changes even for devices with orientation-lock turned on.","archived":false,"fork":false,"pushed_at":"2020-10-16T16:15:00.000Z","size":210,"stargazers_count":19,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T13:02:16.393Z","etag":null,"topics":["device-orientation","ios","orientation-detection","orientation-tracking","swift"],"latest_commit_sha":null,"homepage":"https://www.amerhukic.com","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/amerhukic.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":"2019-02-13T21:45:29.000Z","updated_at":"2023-05-09T05:42:07.000Z","dependencies_parsed_at":"2022-08-21T04:50:35.916Z","dependency_job_id":null,"html_url":"https://github.com/amerhukic/OrientationTracker","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/amerhukic%2FOrientationTracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amerhukic%2FOrientationTracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amerhukic%2FOrientationTracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amerhukic%2FOrientationTracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amerhukic","download_url":"https://codeload.github.com/amerhukic/OrientationTracker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244409597,"owners_count":20448193,"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":["device-orientation","ios","orientation-detection","orientation-tracking","swift"],"created_at":"2025-03-19T10:36:39.915Z","updated_at":"2026-03-09T15:02:03.979Z","avatar_url":"https://github.com/amerhukic.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/amerhukic/OrientationTracker/master/Logo.png\" width=\"570\" max-width=\"80%\" alt=\"Logo\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Swift-5.0-orange.svg\" /\u003e\n    \u003ca href=\"https://cocoapods.org/pods/OrientationTracker\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/v/OrientationTracker.svg?style=flat\" alt=\"Pod Version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/Licence-MIT-green.svg\" alt=\"License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://twitter.com/hukicamer\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/contact-%40hukicamer-blue.svg?style=flat\" alt=\"Twitter: @hukicamer\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n**OrientationTracker** is a Core Motion based library for tracking device orientation changes. It also works for devices with orientation-lock turned on. You can subscribe to orientation change notifications and react accordingly.\n\n## Requirements\n\n- iOS 8.0+\n- Xcode 10.2\n- Swift 5.0\n\n## Usage\n\nTo start device orientation tracking use `OrientationTracker` you simply invoke the `startDeviceOrientationTracking` method, preferably in `AppDelegate` :\n```swift\nDeviceOrientationDetector.shared.startDeviceOrientationTracking()\n```\n\nYou then add an observer for the `OrientationTracker.deviceOrientationChangedNotification` and react to orientation changes:\n```swift\nNotificationCenter.default.addObserver(self, selector: #selector(updateViews), name: DeviceOrientationDetector.deviceOrientationChangedNotification, object: nil)\n```\n\nYou can access the current orientation using the `currentDeviceOrientation` property.\n\nTo stop receiving notifications use the `stopDeviceOrientationTracking` method:\n```swift\nDeviceOrientationDetector.shared.stopDeviceOrientationTracking()\n```\n\nIf your app supports portrait mode only, you can use the `affineTransform` property to rotate views when the orientation changes:\n```swift\nUIView.animate(withDuration: 0.2) {\n    self.imageView.transform = DeviceOrientationDetector.shared.affineTransform\n}\n```\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate OrientationTracker into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'OrientationTracker'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n## Author\n\n[Amer Hukić](https://amerhukic.com)\n\n## License\n\nOrientationTracker is licensed under the MIT license. Check the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famerhukic%2Forientationtracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famerhukic%2Forientationtracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famerhukic%2Forientationtracker/lists"}