I’ve been lucky enough to volunteer as a teacher at my daughters’ school, teaching programming to the girls there. It’s a fun job: they try things I’d never think of, ask questions that really make me pause for thought, and give me a lot of hope for the future of our industry.
But one thing that has struck me time and time again is how important physical computing is: we can talk about theory as much as we want, and write a fair amount code to go along with it, but nothing inspires them so much as picking up a real piece of hardware and watching it respond to human interaction.
Dan O’Sullivan once wrote, “personal computers have evolved in an office environment in which you sit on your butt, moving only your fingers, entering and receiving information censored by your conscious mind. That is not your whole life, and probably not even the best part – we need to think about computers that sense more of your body, serve you in more places, and convey the physical expression in addition to information.”
I hope you’re ready to take on that challenge, because today you’re going to meet Core Motion – Apple’s framework that handles the accelerometer and gyroscope inside all iOS devices. In plain terms, that means it lets us tell how users are holding their devices in the physical world. Now, I know Apple do a huge amount of work behind the scenes to read in data from a variety of finely calibrated sensors, but that gets distilled down into a set of numbers telling us how much tilt the device has on its X, Y, and Z axis. And the result is something quite remarkable: suddenly you’re no longer holding an iPad, but a board with a rolling ball, an ARKit route finder, or even a window into a virtual world.
What I love about the accelerometer is that it’s invisibly ubiquitous – it’s in every iOS device, but we never think about it and we don’t need to ask permission to use it. But as you’ll see as we work through project 25, reading motion data opens up another fabulous range of possibilities for your app ideas, and it only takes a handful of lines of code.
Today you have two topics to work through, and you’ll learn how to load a game level from a file and how to create custom physics bitmasks, while also getting some practice with
SKAction, and more.
Need help? Tweet me @twostraws!
SPONSORED From August 2nd to 8th you can join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer!
Link copied to your pasteboard.