{"id":14961318,"url":"https://github.com/maximbilan/ios-coremotion-example","last_synced_at":"2025-10-24T20:31:36.080Z","repository":{"id":76125858,"uuid":"50115928","full_name":"maximbilan/iOS-CoreMotion-Example","owner":"maximbilan","description":"Core Motion in iOS using Swift","archived":false,"fork":false,"pushed_at":"2018-09-22T09:30:47.000Z","size":105,"stargazers_count":106,"open_issues_count":0,"forks_count":20,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-31T04:16:18.111Z","etag":null,"topics":["accelerometer","accelerometer-data","coremotion","device-motion","gyroscope","ios","motion","motion-framework","motionevent","swift","tutorial"],"latest_commit_sha":null,"homepage":"","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/maximbilan.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-21T15:18:29.000Z","updated_at":"2024-09-03T16:18:44.000Z","dependencies_parsed_at":"2023-02-25T05:30:36.485Z","dependency_job_id":null,"html_url":"https://github.com/maximbilan/iOS-CoreMotion-Example","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"c9e6146013b172bc073c26fd2093afd44036a9ab"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximbilan%2FiOS-CoreMotion-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximbilan%2FiOS-CoreMotion-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximbilan%2FiOS-CoreMotion-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maximbilan%2FiOS-CoreMotion-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maximbilan","download_url":"https://codeload.github.com/maximbilan/iOS-CoreMotion-Example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238035385,"owners_count":19405682,"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":["accelerometer","accelerometer-data","coremotion","device-motion","gyroscope","ios","motion","motion-framework","motionevent","swift","tutorial"],"created_at":"2024-09-24T13:24:46.680Z","updated_at":"2025-10-24T20:31:30.675Z","avatar_url":"https://github.com/maximbilan.png","language":"Swift","readme":"# Core Motion in iOS using Swift\n\nUsers generate motion events when they move, shake, or tilt the device. These motion events are detected by the device hardware, specifically, the accelerometer and the gyroscope. The \u003ci\u003e\u003ca href=\"https://developer.apple.com/library/ios/documentation/CoreMotion/Reference/CoreMotion_Reference/\"\u003eCore Motion\u003c/a\u003e\u003c/i\u003e framework lets your application receive motion data from the device hardware and process that data.\n\n![alt tag](https://raw.github.com/maximbilan/iOS-CoreMotion-Example/master/images/1.png)\n\nTo get started import the \u003ci\u003e\u003ca href=\"https://developer.apple.com/library/ios/documentation/CoreMotion/Reference/CoreMotion_Reference/\"\u003eCore Motion\u003c/a\u003e\u003c/i\u003e framework like this:\n\n\u003cpre\u003e\nimport CoreMotion\n\u003c/pre\u003e\n\nNow create an instance of \u003ci\u003e\u003ca href=\"https://developer.apple.com/library/ios/documentation/CoreMotion/Reference/CMMotionManager_Class/\"\u003eCMMotionManager\u003c/a\u003e\u003c/i\u003e object. The app can use it to receive four types of motion: raw accelerometer data, raw gyroscope data, raw magnetometer data, and processed device-motion data (which includes accelerometer, rotation-rate, and attitude measurements).\n\n\u003cpre\u003e\nlet motionManager = CMMotionManager()\n\u003c/pre\u003e\n\nFor starting accelerometer updates you need to call the next method:\n\n\u003cpre\u003e\nfunc startAccelerometerUpdates()\n\u003c/pre\u003e\n\nFinally, read the accelerometer data as often as you want.\n\n\u003cpre\u003e\nif let accelerometerData = motionManager.accelerometerData {\n}\n\u003c/pre\u003e\n\nYou can change \u003ci\u003e\u003ca href=\"https://developer.apple.com/library/ios/documentation/CoreMotion/Reference/CMMotionManager_Class/#//apple_ref/occ/instp/CMMotionManager/accelerometerUpdateInterval\"\u003eaccelerometerUpdateInterval\u003c/a\u003e\u003c/i\u003e, the interval, in seconds, for providing accelerometer updates to the block handler.\n\nThe same story for \u003ci\u003eGyroscope\u003c/i\u003e, \u003ci\u003eMagnetometer\u003c/i\u003e and \u003ci\u003eDevice motion\u003c/i\u003e.\n\n\u003cpre\u003e\nfunc startGyroUpdates()\nfunc startMagnetometerUpdates()\nfunc startDeviceMotionUpdates()\n\u003c/pre\u003e\n\nHappy coding!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximbilan%2Fios-coremotion-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaximbilan%2Fios-coremotion-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaximbilan%2Fios-coremotion-example/lists"}