1
00:00:07,170 --> 00:00:12,660
Hey again guys this is Caleb with slopes dot com and in this video we're going to look at a few pages

2
00:00:12,660 --> 00:00:17,720
from Apple's documentation for swift that explains what core motion is.

3
00:00:17,850 --> 00:00:24,300
And we're also going to dive into the sea motion manager subclass where we'll be able to see all the

4
00:00:24,300 --> 00:00:26,940
things that we get access to and it's not just the accelerometer.

5
00:00:26,940 --> 00:00:28,110
That's the coolest part.

6
00:00:28,110 --> 00:00:32,910
What you learn in this course can be applied to actually quite a few other instruments on your iPhone

7
00:00:32,940 --> 00:00:33,510
that exist.

8
00:00:33,510 --> 00:00:39,050
So go ahead and pull open a Safari window and you can either Google you know Apple documentation core

9
00:00:39,050 --> 00:00:44,760
motion or just go to developer dot apple dot com slash documentation's slash core emotion.

10
00:00:44,760 --> 00:00:47,720
It's up to you but this is where we're going to start.

11
00:00:47,730 --> 00:00:56,970
And as you can see core motion helps to process accelerometer gyroscope pedometer and environment related

12
00:00:57,090 --> 00:00:57,860
events.

13
00:00:57,990 --> 00:01:05,070
Now believe it or not it actually gives you the ability to use the Magg magnetometer as well.

14
00:01:05,250 --> 00:01:11,490
And I've seen some really cool uses for that like the Google cardboard VR headset for instance uses

15
00:01:11,490 --> 00:01:19,320
the magnet magnetometer I always want to say magnetometer but the magnetometer to sense disturbances

16
00:01:19,320 --> 00:01:23,280
in the magnetic field around the iPhone that's like you know how it uses the compass.

17
00:01:23,310 --> 00:01:29,910
So when your phone is in the Google cardboard VR headset there's actually a magnet on the side and when

18
00:01:29,910 --> 00:01:35,700
you pull that magnet down what happens is the magnet rushes by the magnetometer in the iPhone.

19
00:01:35,700 --> 00:01:41,160
It senses a disturbance and it uses that magnet input as a trigger system so you can like you know shoot

20
00:01:41,160 --> 00:01:43,920
guns in games in VR It's really really cool.

21
00:01:43,920 --> 00:01:48,350
So there's tons of uses for the magnetometer the pedometer gyroscopes accelerometer.

22
00:01:48,360 --> 00:01:55,140
I'm sure you can think of many uses for this but we're going to go ahead and look now at the CME motion

23
00:01:55,140 --> 00:01:56,580
manager subclass.

24
00:01:56,600 --> 00:01:57,460
All right.

25
00:01:57,600 --> 00:02:03,150
And it is the object for starting and managing motion services so that's what we need to know because

26
00:02:03,150 --> 00:02:04,940
that's where it begins.

27
00:02:04,950 --> 00:02:12,600
So as you can see well they updated us here they added data for the magnetometer in Iowa S5 because

28
00:02:12,600 --> 00:02:18,090
that's when an iPhone was first released with a magnetometer I believe it was the iPhone 3G S that had

29
00:02:18,090 --> 00:02:18,530
the compass.

30
00:02:18,540 --> 00:02:19,960
But anyway.

31
00:02:20,110 --> 00:02:28,320
So you use a CM motion manager object to access accelerometer data rotation rate data magnetometer rate

32
00:02:28,320 --> 00:02:31,180
data and other device motion data.

33
00:02:31,260 --> 00:02:37,020
These types of data originate with the devices accelerometers it's magnetometer and gyroscope.

34
00:02:37,260 --> 00:02:39,510
Typo there should be a space anyway.

35
00:02:39,520 --> 00:02:42,480
So as you can see there's lots of information here.

36
00:02:42,510 --> 00:02:49,520
We can get access to the accelerometer the devices gyroscope magnetometer and the device motion as well.

37
00:02:49,520 --> 00:02:51,150
And there's all kinds of data we can get.

38
00:02:51,150 --> 00:02:52,610
And guys I kid you not.

39
00:02:52,620 --> 00:02:56,670
It is so easy to actually pull out this data and do stuff with it.

40
00:02:56,670 --> 00:03:00,200
It's very cool how Apple has set it up for us to use.

41
00:03:00,210 --> 00:03:06,180
So now that we've sort of seen the documentation and now that we understand the full scope of what is

42
00:03:06,180 --> 00:03:11,970
possible we're going to go ahead and dive into receiving accelerometer updates with S.M. motion managers

43
00:03:11,970 --> 00:03:16,620
so we're going to head over to the next video and we're going to start writing out that code right now.

44
00:03:16,620 --> 00:03:19,110
So let's head over there and let's get started.
