88
99## Spren UI
1010
11- ### Implementation Example
11+ ### Implementation Examples
12+
13+ #### Finger Camera
1214
1315``` swift
1416import SwiftUI
@@ -29,20 +31,61 @@ let config = SprenUI.Config(
2931 primaryColor : < optional , Color> , // used for buttons
3032 secondaryColor : < optional , Color> , // used for graphics
3133
32- project : .fingerCamera , // or `.bodyComp`
34+ project : .fingerCamera ,
3335
3436 // optionally override default intro screen graphics
3537 // provide names for image sets in main bundle xcassets
3638 // *all are required for each project if overriding
3739 graphics : [
38- // for a `.fingerCamera` project
3940 .greeting1 : " <image set name>" , // greeting screen 1
4041 .greeting2 : " <image set name>" , // greeting screen 2
4142 .fingerOnCamera : " <image set name>" , // finger on camera instruction screen
4243 .noCamera : " <image set name>" , // camera access authorization denied screen
4344 .serverError : " <image set name>" // server or calculation error
45+ ],
46+
47+ onCancel : {
48+ // user exited UI before completing a reading
49+ // dismiss SprenUI
50+ },
51+ onFinish : { results in
52+ // user completed a reading!
53+ print (results)
54+ // dismiss SprenUI
55+ }
56+ )
57+
58+ // init SprenUI view
59+ SprenUI (config : config)
60+
61+ ```
62+
63+ #### Body Composition
64+ ``` swift
65+ import SwiftUI
66+ import SprenUI
67+
68+ // create SprenUI configuration
69+ let config = SprenUI.Config (
70+ // API
71+ baseURL : " https://test.api.spren.com" ,
72+ apiKey : " <API key>" ,
73+
74+ // user
75+ userID : " <user ID>" ,
76+ userGender : < optional , male, female, or other> ,
77+ userBirthdate : < optional , Date> ,
78+
79+ // UI
80+ primaryColor : < optional , Color> , // used for buttons
81+ secondaryColor : < optional , Color> , // used for graphics
82+
83+ project : .bodyComp ,
4484
45- // for a `.bodyComp` project
85+ // optionally override graphics
86+ // provide names for image sets in main bundle xcassets
87+ // *all are required for each project if overriding
88+ graphics : [
4689 .setupGuide : " <image set name>" ,
4790 .serverError : " <image set name>" ,
4891 .privacy : " <image set name>" ,
@@ -53,11 +96,11 @@ let config = SprenUI.Config(
5396 ],
5497
5598 onCancel : {
56- // user exited UI before completing a reading
99+ // user exited UI before completing a scan
57100 // dismiss SprenUI
58101 },
59102 onFinish : { results in
60- // user completed a reading !
103+ // user completed a scan !
61104 print (results)
62105 // dismiss SprenUI
63106 }
0 commit comments