You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To add `ProgressKit` as Carthage dependency insert the following line to your `Cartfile`:
18
-
19
-
```
20
-
github "Progress4Apple/ProgressKit" ~> 1.0
21
-
```
22
-
23
-
Let `Carthage` download and compile the library by executing the following command:
24
-
25
-
```
26
-
carthage bootstrap --platform iOS
27
-
```
7
+
See the Getting Started section of the README for how to install `ProgressKit`.
28
8
29
-
As last step add the built libraries in Xcode. See ["Adding frameworks to an application" in the Carthage documentation for further details](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application):
30
-
31
-
-`ProgressKit.framework`
32
-
-`FLAnimatedImage.framework`
33
-
-`GiphyCoreSDK.framework`
34
-
35
-
## Usage
9
+
## Configuration
36
10
37
11
Import `ProgressKit` and call `Progress.configure(...)` in `application(_:didFinishLaunchingWithOptions:)` of your AppDelegate.swift for initialization:
To render the progress bars for the available reports, create a new `UICollectionViewController` in your app and subclass the `ProgressCollectionViewController`:
34
+
35
+
```
36
+
import UIKit
37
+
import ProgressKit
38
+
39
+
class ViewController: ProgressCollectionViewController {
40
+
...
41
+
}
42
+
````
43
+
44
+
## Set delegate and dataSource
45
+
46
+
Make sure you set the ViewController's delegate and dataSource objects In your `viewDidLoad`. To begin with, we set both to `self`:
47
+
48
+
```
49
+
import UIKit
50
+
import ProgressKit
51
+
52
+
class ViewController: ProgressCollectionViewController {
53
+
54
+
override func viewDidLoad() {
55
+
super.viewDidLoad()
56
+
57
+
delegate = self
58
+
dataSource = self
59
+
}
60
+
}
61
+
```
62
+
63
+
Then we make sure our ViewController conforms to `ProgressCollectionViewControllerDelegate`:
64
+
65
+
```
66
+
import UIKit
67
+
import ProgressKit
68
+
import EventKit
69
+
70
+
class ViewController: ProgressCollectionViewController, ProgressCollectionViewControllerDelegate {
There you go. That's the bare minimum you need to render reports. As next step you may want to add your implementation for saving and loading reports so the user is able to configure those. For this have a look at `PKReportStore.standard` which makes it easy to persist and query reports to/from disk.
/// Helper function which determines the desired `PKLayoutStyle` based upon a given [`UITraitCollection`](https://developer.apple.com/documentation/uikit/uitraitcollection).
0 commit comments