In the previous tutorial we found how to use the CMPedometer and CMActivityManager to fetch the steps and the current activity state.
This is how the graph will look
Lets look at the change in the main storyboard from the previous tutorial
- First create a new file called ChartViewController.Swift which is a subtype of UIViewController. (File New -> iOS Source -> Cocoa Touch Class)
In the identity inspector set the type to ChartViewController.
Add a button
dismissto the viewcontroller
- Create a
IBActionfrom dismiss to the ChartViewController( Use the CTRL+Drag trick. CTRL+DRAG from dismiss button to the ChartViewController)
UIViewfrom the object library on to the ChartViewController and setup the autolayout constraints as below.
UIViewgo to Identity inspector and change the Class to
- CTRL+DRAG from uiview on to the ChartViewController and create a IBOutlet with name as