Skip to content

Commit 24260b2

Browse files
author
Mike Hill
committed
made a ton of properties optional to make generating the OCS files simpler, but importing a bit more work (optionals)
1 parent 91ce770 commit 24260b2

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

swift/OpenClockStandard/ClockStandard.swift

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ public struct ClockLayer: Codable {
7474
public var type: ClockLayerTypes = .text
7575

7676
public var zIndex: Int = 0 //0 is bottom higher is top. layering
77-
public var customName: String = "" //each layer can have user generated names or empty
78-
public var imageFilename: String = "" // filenames for images used in the layer
79-
public var fillColor: String = "" // fill color ( re used for public various types )
77+
public var customName: String? = "" //each layer can have user generated names or empty
78+
public var imageFilename: String? = "" // filenames for images used in the layer
79+
public var fillColor: String? = "" // fill color ( re used for public various types )
8080

81-
public var alpha: String = "1.0" //transparency
82-
public var horizontalPosition: String = "0.0" //0 is center : negative left
83-
public var verticalPosition: String = "0.0" //0 is center : negative up
84-
public var scale: String = "1.0" // 1.0 is normal
85-
public var angleOffset: String = "0.0" // rotation of the overall layer
86-
public var isHidden: Bool = false //hide this layer
81+
public var alpha: String? = "1.0" //transparency
82+
public var horizontalPosition: String? = "0.0" //0 is center : negative left
83+
public var verticalPosition: String? = "0.0" //0 is center : negative up
84+
public var scale: String? = "1.0" // 1.0 is normal
85+
public var angleOffset: String? = "0.0" // rotation of the overall layer
86+
public var isHidden: Bool? = false //hide this layer
8787

8888
//optional objects to hold properties for the layers
8989
public var textOptions: ClockLayerTextOptions?
@@ -120,11 +120,11 @@ public struct ClockLayerDataBarOptions: Codable {
120120
}
121121

122122
public var format: ClockLayerDataRingFormats = .energyBurned
123-
public var autoColor: Bool = true //automatically set the color of the ring based on format: default false, can ignore for the most part
124-
public var cornerRadius: String = "0.0" //for rounding off the bars
125-
public var width: String = "0.2" // not necessarily same scale as the main canvas, but close
126-
public var height: String = "0.5" // not necessarily same scale as the main canvas, but close
127-
public var colors: [String] = [] //array[ count 3] of hex colors for background, start, then end
123+
public var autoColor: Bool? = true //automatically set the color of the ring based on format: default false, can ignore for the most part
124+
public var cornerRadius: String? = "0.0" //for rounding off the bars
125+
public var width: String? = "0.2" // not necessarily same scale as the main canvas, but close
126+
public var height: String? = "0.5" // not necessarily same scale as the main canvas, but close
127+
public var colors: [String]? = [] //array[ count 3] of hex colors for background, start, then end
128128
}
129129

130130
public struct ClockLayerHandOptions: Codable {
@@ -154,20 +154,20 @@ public struct ClockLayerHandOptions: Codable {
154154
}
155155

156156
public var handType: ClockLayerHandTypes = .hour
157-
public var handStyle: String = "plain"
157+
public var handStyle: String? = "plain"
158158
// SecondHandGallery = useImage:true
159159
/* case SecondHandTypeSwiss, SecondhandTypeSwissCircle, SecondHandTypeRail, SecondHandTypeBlocky, SecondHandTypeRoman, SecondHandTypePointy, SecondHandTypeSquaredHole, SecondHandTypeArrow, SecondHandTypeSphere,
160160
SecondHandTypeDualTime,
161161
SecondHandTypeFancyRed, SecondHandTypeFlatDial, SecondHandTypeThinDial, SecondHandTypePacMan, SecondHandTypeMsPacMan, SecondHandTieFighter, SecondHandRadar, SecondHandTrails, SecondHandCircleSegment,
162162
SecondHandCircleSegmentInverted,
163163
SecondHandTypeImageMoon, SecondHandTypeImageNumbers,
164164
SecondHandNodeTypeNone,SecondHandTypeImageSubmariner,SecondHandGallery */
165-
public var handStyleDescription: String = "" // localized text description of the hand style
166-
public var animationType: String = "" // will be specific to platforms, might want to ignore
167-
public var useImage: Bool = false // use images instead of vectors
168-
public var animateClockwise: Bool = true //used usually in combination with images that have numbers to animate in reverse to show numbers increasing for time
169-
public var imageAnchorX: String = "" //when using images the anchor position ( bottom / centered of the image ) default: 0.5
170-
public var imageAnchorY: String = "" //when using images the anchor position ( bottom / centered of the image ) default: 0.5
165+
public var handStyleDescription: String? = "" // localized text description of the hand style
166+
public var animationType: String? = "" // will be specific to platforms, might want to ignore
167+
public var useImage: Bool? = false // use images instead of vectors
168+
public var animateClockwise: Bool? = true //used usually in combination with images that have numbers to animate in reverse to show numbers increasing for time
169+
public var imageAnchorX: String? = "" //when using images the anchor position ( bottom / centered of the image ) default: 0.5
170+
public var imageAnchorY: String? = "" //when using images the anchor position ( bottom / centered of the image ) default: 0.5
171171
}
172172

173173
public struct ClockLayerWeatherOptions: Codable {
@@ -217,11 +217,11 @@ public struct ClockLayerTextOptions: Codable {
217217
self.kerning = kerning
218218
}
219219

220-
public var casingType: ClockLayerTextCasing = .none
221-
public var fontFamily: String = "SFSystem" // https://developer.apple.com/fonts/
222-
public var fontFilename: String = ""
223-
public var fontDescription: String = ""
224-
public var dateTimeFormat: String = ""
220+
public var casingType: ClockLayerTextCasing? = .none
221+
public var fontFamily: String? = "SFSystem" // https://developer.apple.com/fonts/
222+
public var fontFilename: String? = ""
223+
public var fontDescription: String? = ""
224+
public var dateTimeFormat: String? = ""
225225
/* enum options
226226
HHMMSS,
227227
HHMM,
@@ -257,7 +257,7 @@ public struct ClockLayerTextOptions: Codable {
257257
SecondsWordUnit
258258

259259
*/
260-
public var dateTimeFormatDescription: String = ""
260+
public var dateTimeFormatDescription: String? = ""
261261
/*
262262
case .Battery: description = "Battery %"
263263
case .BatteryNum: "Battery"
@@ -293,12 +293,12 @@ public struct ClockLayerTextOptions: Codable {
293293
case .Colon: ": - colon"
294294
case .Slash: "/ - slash"
295295
*/
296-
public var customText: String = "" // designer entered text to show in label
297-
public var justification: ClockLayerTextJustification = .centered
298-
public var effectType: String = "" // will be specific to platforms, might want to ignore
299-
public var outlineWidth: String = "0.0" // pixels to show as outline on the text
300-
public var outlineColor: String = "" // color for outline
301-
public var kerning: String = "0.0" // added as adv option, probably ignore
296+
public var customText: String? = "" // designer entered text to show in label
297+
public var justification: ClockLayerTextJustification? = .centered
298+
public var effectType: String? = "" // will be specific to platforms, might want to ignore
299+
public var outlineWidth: String? = "0.0" // pixels to show as outline on the text
300+
public var outlineColor: String? = "" // color for outline
301+
public var kerning: String? = "0.0" // added as adv option, probably ignore
302302
}
303303

304304
public struct ClockLayerDataLabelOptions: Codable {
@@ -354,8 +354,8 @@ public struct ClockLayerDataLabelOptions: Codable {
354354
Battery,
355355
BatteryNum,
356356
*/
357-
public var dataLabelFormatDescription: String = ""
358-
public var unitDisplayLevel: ClockLayerUnitDisplayLevel = .medium //preference for how much of the units to show along-side the data, IE: 32 degrees celcius v 32
357+
public var dataLabelFormatDescription: String? = ""
358+
public var unitDisplayLevel: ClockLayerUnitDisplayLevel? = .medium //preference for how much of the units to show along-side the data, IE: 32 degrees celcius v 32
359359
}
360360

361361
public enum ClockLayerDataBarStyles: String, Codable {

0 commit comments

Comments
 (0)