CoreMotion with Step Counter in iOS with Swift 5

CoreMotion with Step Counter in iOS with Swift 5
July 18, 2020 No Comments Development,iOS Development Pushpendra Kumar

Hey, Guys welcome to this tutorial. In this complete video, I will make you understand the quick trick. And the quick trick is about CoreMotion with Step Counter in iOS with Swift 5. And this is a simple way to achieve our goals. Through this simple video tutorial, you can learn more interesting things about the CoreMotion with Step Counter in iOS with Swift 5. So watch the complete video. And if you watched the complete video then do not forget to give your suggestion into the comment box. Because your feedback & suggestions do matter for me πŸ˜ŠπŸ˜ŠπŸ˜ŠπŸ˜ŠπŸ‘‡πŸ»

And finally, I would like to say that, If you like this video and it’s helpful for your project then click on the like button and do not forget to subscribe to this YouTube channel for future updates. 

Great, I hope you watch the complete video. Below I am writing the important code related to above video.

CoreMotion with Step Counter

Firstly get the code for info.plist

<key>NSMotionUsageDescription</key>
    <string>Here please give the description of the usage</string>

After that get the code for PedoMeter and CMMotionActivityManager.

self.activityManager.startActivityUpdates(to: OperationQueue.main) { (data) in
                DispatchQueue.main.async {
                    if let activity = data {
                        if activity.running == true {
                            print("Running")
                        }else if activity.walking == true {
                            print("Walking")
                        }else if activity.automotive == true {
                            print("Automative")
                        }
                    }
                }
            }

Great catch, now get the code about the CMPedoMeter

self.pedoMeter.startUpdates(from: Date()) { (data, error) in
                if error == nil {
                    if let response = data {
                        DispatchQueue.main.async {
                            print("Number Of Steps == \(response.numberOfSteps)")
                            
                            self.lbCounter.text = "Step Counter : \(response.numberOfSteps)"
                        }
                    }
                }
            }

Great job, I hope you watch the complete video.

Good work, I hoe you have follow the complete video tutorial.

In Conclusion, You have done with this tutorial. And I hope now the concept of CoreMotion with Step Counter in iOS with Swift 5 is clear. Firstly, If you have any doubts regarding the CoreMotion with Step Counter in iOS with Swift 5. Then you can comment into the comment box. And If you like this tutorial with a complete description of the simple and attractive tutorial in iOS then please like my video on YouTube and do not forget to subscribe to my YouTube channel. Because you will get lots of videos related to swift development with very sort tricks.

In addition, If you are more curious about the development and knowing about tutorials then follow the below links πŸ‘‡πŸ»πŸ‘‡πŸ»πŸ‘‡πŸ»πŸ˜Ž

Tags
About The Author
Pushpendra Kumar I am passionate about mobile application development and professional developer at Colour Moon Technologies Pvt Ltd (www.thecolourmoon.com). This website I have made so that I can meet with new challenges and can share here.

Leave a reply

Your email address will not be published. Required fields are marked *