Skip to content

Commit b7a688d

Browse files
authored
Merge pull request #11 from chasepeeler/refactorapi
added support for specifying units and axis style as well as handling… fixed issue #8
2 parents 5960733 + 72ea3da commit b7a688d

14 files changed

+841
-135
lines changed

GlucoseViewer.xcodeproj/project.pbxproj

Lines changed: 158 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,61 @@
1010
AB1292DC2972064F00C7615F /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1292DB2972064F00C7615F /* SettingsView.swift */; };
1111
AB1292DF29732B9600C7615F /* GlucoseDetailsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1292DE29732B9600C7615F /* GlucoseDetailsView.swift */; };
1212
AB1292E12976155B00C7615F /* GlucoseViewerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1292E02976155B00C7615F /* GlucoseViewerApp.swift */; };
13+
AB1292E92977BB2A00C7615F /* GlucoseViewerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1292E82977BB2A00C7615F /* GlucoseViewerTests.swift */; };
14+
AB71105C2979F68000AD071E /* NightscoutAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB71105B2979F68000AD071E /* NightscoutAPI.swift */; };
15+
AB71105E297A085000AD071E /* NightscoutAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB71105D297A085000AD071E /* NightscoutAPITests.swift */; };
16+
AB711060297A2B8200AD071E /* invalidjson.json in Resources */ = {isa = PBXBuildFile; fileRef = AB71105F297A2B8200AD071E /* invalidjson.json */; };
17+
AB711062297A2DA700AD071E /* validjson.json in Resources */ = {isa = PBXBuildFile; fileRef = AB711061297A2DA700AD071E /* validjson.json */; };
18+
AB711064297B7FF900AD071E /* stringdelta.json in Resources */ = {isa = PBXBuildFile; fileRef = AB711063297B7FF900AD071E /* stringdelta.json */; };
19+
AB711066297B8C9300AD071E /* GlucoseViewerSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB711065297B8C9300AD071E /* GlucoseViewerSettings.swift */; };
20+
AB711068297B900500AD071E /* settings.json in Resources */ = {isa = PBXBuildFile; fileRef = AB711067297B900500AD071E /* settings.json */; };
1321
ABED20CC296E5C8C00647363 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABED20CB296E5C8C00647363 /* Assets.xcassets */; };
1422
ABED20CF296E5C8C00647363 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ABED20CE296E5C8C00647363 /* Preview Assets.xcassets */; };
1523
ABED20D9296F7C0F00647363 /* BGLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABED20D8296F7C0F00647363 /* BGLabelView.swift */; };
16-
ABED20DB296F7DF400647363 /* BGReading.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABED20DA296F7DF400647363 /* BGReading.swift */; };
24+
ABED20DB296F7DF400647363 /* BGLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABED20DA296F7DF400647363 /* BGLabel.swift */; };
1725
ABED20DD296F7E2B00647363 /* BGDirectionEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABED20DC296F7E2B00647363 /* BGDirectionEnum.swift */; };
1826
/* End PBXBuildFile section */
1927

28+
/* Begin PBXContainerItemProxy section */
29+
AB1292EA2977BB2A00C7615F /* PBXContainerItemProxy */ = {
30+
isa = PBXContainerItemProxy;
31+
containerPortal = ABED20BC296E5C8B00647363 /* Project object */;
32+
proxyType = 1;
33+
remoteGlobalIDString = ABED20C3296E5C8B00647363;
34+
remoteInfo = GlucoseViewer;
35+
};
36+
/* End PBXContainerItemProxy section */
37+
2038
/* Begin PBXFileReference section */
2139
AB1292DB2972064F00C7615F /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
2240
AB1292DE29732B9600C7615F /* GlucoseDetailsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlucoseDetailsView.swift; sourceTree = "<group>"; };
2341
AB1292E02976155B00C7615F /* GlucoseViewerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlucoseViewerApp.swift; sourceTree = "<group>"; };
42+
AB1292E62977BB2A00C7615F /* GlucoseViewerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GlucoseViewerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
43+
AB1292E82977BB2A00C7615F /* GlucoseViewerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlucoseViewerTests.swift; sourceTree = "<group>"; };
44+
AB71105B2979F68000AD071E /* NightscoutAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NightscoutAPI.swift; sourceTree = "<group>"; };
45+
AB71105D297A085000AD071E /* NightscoutAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NightscoutAPITests.swift; sourceTree = "<group>"; };
46+
AB71105F297A2B8200AD071E /* invalidjson.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = invalidjson.json; sourceTree = "<group>"; };
47+
AB711061297A2DA700AD071E /* validjson.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = validjson.json; sourceTree = "<group>"; };
48+
AB711063297B7FF900AD071E /* stringdelta.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = stringdelta.json; sourceTree = "<group>"; };
49+
AB711065297B8C9300AD071E /* GlucoseViewerSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlucoseViewerSettings.swift; sourceTree = "<group>"; };
50+
AB711067297B900500AD071E /* settings.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = settings.json; sourceTree = "<group>"; };
2451
ABED20C4296E5C8B00647363 /* GlucoseViewer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GlucoseViewer.app; sourceTree = BUILT_PRODUCTS_DIR; };
2552
ABED20CB296E5C8C00647363 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2653
ABED20CE296E5C8C00647363 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2754
ABED20D0296E5C8C00647363 /* GlucoseViewer.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = GlucoseViewer.entitlements; sourceTree = "<group>"; };
2855
ABED20D8296F7C0F00647363 /* BGLabelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BGLabelView.swift; sourceTree = "<group>"; };
29-
ABED20DA296F7DF400647363 /* BGReading.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BGReading.swift; sourceTree = "<group>"; };
56+
ABED20DA296F7DF400647363 /* BGLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BGLabel.swift; sourceTree = "<group>"; };
3057
ABED20DC296F7E2B00647363 /* BGDirectionEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BGDirectionEnum.swift; sourceTree = "<group>"; };
3158
/* End PBXFileReference section */
3259

3360
/* Begin PBXFrameworksBuildPhase section */
61+
AB1292E32977BB2A00C7615F /* Frameworks */ = {
62+
isa = PBXFrameworksBuildPhase;
63+
buildActionMask = 2147483647;
64+
files = (
65+
);
66+
runOnlyForDeploymentPostprocessing = 0;
67+
};
3468
ABED20C1296E5C8B00647363 /* Frameworks */ = {
3569
isa = PBXFrameworksBuildPhase;
3670
buildActionMask = 2147483647;
@@ -41,10 +75,24 @@
4175
/* End PBXFrameworksBuildPhase section */
4276

4377
/* Begin PBXGroup section */
78+
AB1292E72977BB2A00C7615F /* GlucoseViewerTests */ = {
79+
isa = PBXGroup;
80+
children = (
81+
AB1292E82977BB2A00C7615F /* GlucoseViewerTests.swift */,
82+
AB71105D297A085000AD071E /* NightscoutAPITests.swift */,
83+
AB71105F297A2B8200AD071E /* invalidjson.json */,
84+
AB711061297A2DA700AD071E /* validjson.json */,
85+
AB711063297B7FF900AD071E /* stringdelta.json */,
86+
AB711067297B900500AD071E /* settings.json */,
87+
);
88+
path = GlucoseViewerTests;
89+
sourceTree = "<group>";
90+
};
4491
ABED20BB296E5C8B00647363 = {
4592
isa = PBXGroup;
4693
children = (
4794
ABED20C6296E5C8B00647363 /* GlucoseViewer */,
95+
AB1292E72977BB2A00C7615F /* GlucoseViewerTests */,
4896
ABED20C5296E5C8B00647363 /* Products */,
4997
);
5098
sourceTree = "<group>";
@@ -53,6 +101,7 @@
53101
isa = PBXGroup;
54102
children = (
55103
ABED20C4296E5C8B00647363 /* GlucoseViewer.app */,
104+
AB1292E62977BB2A00C7615F /* GlucoseViewerTests.xctest */,
56105
);
57106
name = Products;
58107
sourceTree = "<group>";
@@ -64,11 +113,13 @@
64113
ABED20D0296E5C8C00647363 /* GlucoseViewer.entitlements */,
65114
ABED20CD296E5C8C00647363 /* Preview Content */,
66115
ABED20D8296F7C0F00647363 /* BGLabelView.swift */,
67-
ABED20DA296F7DF400647363 /* BGReading.swift */,
116+
ABED20DA296F7DF400647363 /* BGLabel.swift */,
68117
ABED20DC296F7E2B00647363 /* BGDirectionEnum.swift */,
69118
AB1292DB2972064F00C7615F /* SettingsView.swift */,
70119
AB1292DE29732B9600C7615F /* GlucoseDetailsView.swift */,
71120
AB1292E02976155B00C7615F /* GlucoseViewerApp.swift */,
121+
AB71105B2979F68000AD071E /* NightscoutAPI.swift */,
122+
AB711065297B8C9300AD071E /* GlucoseViewerSettings.swift */,
72123
);
73124
path = GlucoseViewer;
74125
sourceTree = "<group>";
@@ -84,6 +135,24 @@
84135
/* End PBXGroup section */
85136

86137
/* Begin PBXNativeTarget section */
138+
AB1292E52977BB2A00C7615F /* GlucoseViewerTests */ = {
139+
isa = PBXNativeTarget;
140+
buildConfigurationList = AB1292EC2977BB2A00C7615F /* Build configuration list for PBXNativeTarget "GlucoseViewerTests" */;
141+
buildPhases = (
142+
AB1292E22977BB2A00C7615F /* Sources */,
143+
AB1292E32977BB2A00C7615F /* Frameworks */,
144+
AB1292E42977BB2A00C7615F /* Resources */,
145+
);
146+
buildRules = (
147+
);
148+
dependencies = (
149+
AB1292EB2977BB2A00C7615F /* PBXTargetDependency */,
150+
);
151+
name = GlucoseViewerTests;
152+
productName = GlucoseViewerTests;
153+
productReference = AB1292E62977BB2A00C7615F /* GlucoseViewerTests.xctest */;
154+
productType = "com.apple.product-type.bundle.unit-test";
155+
};
87156
ABED20C3296E5C8B00647363 /* GlucoseViewer */ = {
88157
isa = PBXNativeTarget;
89158
buildConfigurationList = ABED20D3296E5C8C00647363 /* Build configuration list for PBXNativeTarget "GlucoseViewer" */;
@@ -112,6 +181,10 @@
112181
LastUpgradeCheck = 1420;
113182
ORGANIZATIONNAME = "Peeler Coding, LLC";
114183
TargetAttributes = {
184+
AB1292E52977BB2A00C7615F = {
185+
CreatedOnToolsVersion = 14.2;
186+
TestTargetID = ABED20C3296E5C8B00647363;
187+
};
115188
ABED20C3296E5C8B00647363 = {
116189
CreatedOnToolsVersion = 14.2;
117190
};
@@ -131,11 +204,23 @@
131204
projectRoot = "";
132205
targets = (
133206
ABED20C3296E5C8B00647363 /* GlucoseViewer */,
207+
AB1292E52977BB2A00C7615F /* GlucoseViewerTests */,
134208
);
135209
};
136210
/* End PBXProject section */
137211

138212
/* Begin PBXResourcesBuildPhase section */
213+
AB1292E42977BB2A00C7615F /* Resources */ = {
214+
isa = PBXResourcesBuildPhase;
215+
buildActionMask = 2147483647;
216+
files = (
217+
AB711062297A2DA700AD071E /* validjson.json in Resources */,
218+
AB711060297A2B8200AD071E /* invalidjson.json in Resources */,
219+
AB711068297B900500AD071E /* settings.json in Resources */,
220+
AB711064297B7FF900AD071E /* stringdelta.json in Resources */,
221+
);
222+
runOnlyForDeploymentPostprocessing = 0;
223+
};
139224
ABED20C2296E5C8B00647363 /* Resources */ = {
140225
isa = PBXResourcesBuildPhase;
141226
buildActionMask = 2147483647;
@@ -148,22 +233,78 @@
148233
/* End PBXResourcesBuildPhase section */
149234

150235
/* Begin PBXSourcesBuildPhase section */
236+
AB1292E22977BB2A00C7615F /* Sources */ = {
237+
isa = PBXSourcesBuildPhase;
238+
buildActionMask = 2147483647;
239+
files = (
240+
AB71105E297A085000AD071E /* NightscoutAPITests.swift in Sources */,
241+
AB1292E92977BB2A00C7615F /* GlucoseViewerTests.swift in Sources */,
242+
);
243+
runOnlyForDeploymentPostprocessing = 0;
244+
};
151245
ABED20C0296E5C8B00647363 /* Sources */ = {
152246
isa = PBXSourcesBuildPhase;
153247
buildActionMask = 2147483647;
154248
files = (
155249
AB1292E12976155B00C7615F /* GlucoseViewerApp.swift in Sources */,
156-
ABED20DB296F7DF400647363 /* BGReading.swift in Sources */,
250+
ABED20DB296F7DF400647363 /* BGLabel.swift in Sources */,
157251
ABED20DD296F7E2B00647363 /* BGDirectionEnum.swift in Sources */,
252+
AB711066297B8C9300AD071E /* GlucoseViewerSettings.swift in Sources */,
158253
AB1292DC2972064F00C7615F /* SettingsView.swift in Sources */,
254+
AB71105C2979F68000AD071E /* NightscoutAPI.swift in Sources */,
159255
ABED20D9296F7C0F00647363 /* BGLabelView.swift in Sources */,
160256
AB1292DF29732B9600C7615F /* GlucoseDetailsView.swift in Sources */,
161257
);
162258
runOnlyForDeploymentPostprocessing = 0;
163259
};
164260
/* End PBXSourcesBuildPhase section */
165261

262+
/* Begin PBXTargetDependency section */
263+
AB1292EB2977BB2A00C7615F /* PBXTargetDependency */ = {
264+
isa = PBXTargetDependency;
265+
target = ABED20C3296E5C8B00647363 /* GlucoseViewer */;
266+
targetProxy = AB1292EA2977BB2A00C7615F /* PBXContainerItemProxy */;
267+
};
268+
/* End PBXTargetDependency section */
269+
166270
/* Begin XCBuildConfiguration section */
271+
AB1292ED2977BB2A00C7615F /* Debug */ = {
272+
isa = XCBuildConfiguration;
273+
buildSettings = {
274+
BUNDLE_LOADER = "$(TEST_HOST)";
275+
CODE_SIGN_STYLE = Automatic;
276+
CURRENT_PROJECT_VERSION = 1;
277+
DEVELOPMENT_TEAM = EKBKRDG4Q9;
278+
GENERATE_INFOPLIST_FILE = YES;
279+
MACOSX_DEPLOYMENT_TARGET = 13.1;
280+
MARKETING_VERSION = 1.0;
281+
ONLY_ACTIVE_ARCH = YES;
282+
PRODUCT_BUNDLE_IDENTIFIER = com.peelercoding.GlucoseViewerTests;
283+
PRODUCT_NAME = "$(TARGET_NAME)";
284+
SWIFT_EMIT_LOC_STRINGS = NO;
285+
SWIFT_VERSION = 5.0;
286+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GlucoseViewer.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/GlucoseViewer";
287+
};
288+
name = Debug;
289+
};
290+
AB1292EE2977BB2A00C7615F /* Release */ = {
291+
isa = XCBuildConfiguration;
292+
buildSettings = {
293+
BUNDLE_LOADER = "$(TEST_HOST)";
294+
CODE_SIGN_STYLE = Automatic;
295+
CURRENT_PROJECT_VERSION = 1;
296+
DEVELOPMENT_TEAM = EKBKRDG4Q9;
297+
GENERATE_INFOPLIST_FILE = YES;
298+
MACOSX_DEPLOYMENT_TARGET = 13.1;
299+
MARKETING_VERSION = 1.0;
300+
PRODUCT_BUNDLE_IDENTIFIER = com.peelercoding.GlucoseViewerTests;
301+
PRODUCT_NAME = "$(TARGET_NAME)";
302+
SWIFT_EMIT_LOC_STRINGS = NO;
303+
SWIFT_VERSION = 5.0;
304+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GlucoseViewer.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/GlucoseViewer";
305+
};
306+
name = Release;
307+
};
167308
ABED20D1296E5C8C00647363 /* Debug */ = {
168309
isa = XCBuildConfiguration;
169310
buildSettings = {
@@ -288,7 +429,7 @@
288429
CODE_SIGN_IDENTITY = "Apple Development";
289430
CODE_SIGN_STYLE = Automatic;
290431
COMBINE_HIDPI_IMAGES = YES;
291-
CURRENT_PROJECT_VERSION = "2201171944-alpha";
432+
CURRENT_PROJECT_VERSION = "2301231754-alpha";
292433
DEVELOPMENT_ASSET_PATHS = "";
293434
DEVELOPMENT_TEAM = EKBKRDG4Q9;
294435
ENABLE_HARDENED_RUNTIME = YES;
@@ -304,7 +445,7 @@
304445
"@executable_path/../Frameworks",
305446
);
306447
MACOSX_DEPLOYMENT_TARGET = 13.0;
307-
MARKETING_VERSION = 0.0.1;
448+
MARKETING_VERSION = 0.0.2;
308449
PRODUCT_BUNDLE_IDENTIFIER = com.peelercoding.GlucoseViewer;
309450
PRODUCT_NAME = "$(TARGET_NAME)";
310451
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -323,7 +464,7 @@
323464
CODE_SIGN_IDENTITY = "Apple Development";
324465
CODE_SIGN_STYLE = Automatic;
325466
COMBINE_HIDPI_IMAGES = YES;
326-
CURRENT_PROJECT_VERSION = "2201171944-alpha";
467+
CURRENT_PROJECT_VERSION = "2301231754-alpha";
327468
DEVELOPMENT_ASSET_PATHS = "";
328469
DEVELOPMENT_TEAM = EKBKRDG4Q9;
329470
ENABLE_HARDENED_RUNTIME = YES;
@@ -339,7 +480,7 @@
339480
"@executable_path/../Frameworks",
340481
);
341482
MACOSX_DEPLOYMENT_TARGET = 13.0;
342-
MARKETING_VERSION = 0.0.1;
483+
MARKETING_VERSION = 0.0.2;
343484
PRODUCT_BUNDLE_IDENTIFIER = com.peelercoding.GlucoseViewer;
344485
PRODUCT_NAME = "$(TARGET_NAME)";
345486
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -351,6 +492,15 @@
351492
/* End XCBuildConfiguration section */
352493

353494
/* Begin XCConfigurationList section */
495+
AB1292EC2977BB2A00C7615F /* Build configuration list for PBXNativeTarget "GlucoseViewerTests" */ = {
496+
isa = XCConfigurationList;
497+
buildConfigurations = (
498+
AB1292ED2977BB2A00C7615F /* Debug */,
499+
AB1292EE2977BB2A00C7615F /* Release */,
500+
);
501+
defaultConfigurationIsVisible = 0;
502+
defaultConfigurationName = Release;
503+
};
354504
ABED20BF296E5C8B00647363 /* Build configuration list for PBXProject "GlucoseViewer" */ = {
355505
isa = XCConfigurationList;
356506
buildConfigurations = (

GlucoseViewer/BGReading.swift renamed to GlucoseViewer/BGLabel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import Foundation
99

1010
struct BGLabel {
11-
var glucose: Int = 0
11+
var glucose: StringableNumber = 0.0
1212
var direction: BGDirection = BGDirection.Flat
13-
var delta: Int = 0
13+
var delta: StringableNumber = 0.0
1414
var status : Status = .Ok
1515
var hasError: Bool {
1616
get {
@@ -20,13 +20,13 @@ struct BGLabel {
2020

2121
var combined : String {
2222
get {
23-
return String(glucose)+" "+directionArrow+" "+signedDelta
23+
return glucose.string+" "+directionArrow+" "+signedDelta
2424
}
2525
}
2626

2727
var signedDelta : String {
2828
get {
29-
return (delta < 0 ? "" : "+")+String(delta)
29+
return (delta.double < 0.0 ? "" : "+")+delta.string
3030
}
3131
}
3232

GlucoseViewer/BGLabelView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct BGLabelView: View {
2121
}
2222

2323
struct BGLabelView_Previews: PreviewProvider {
24-
@State static var bg = BGLabel(glucose: 100, direction: .Flat, delta: 2)
24+
@State static var bg = BGLabel(glucose: "101", direction: .Flat, delta: 2)
2525
static var previews: some View {
2626
BGLabelView(bglabel: $bg)
2727
}

0 commit comments

Comments
 (0)