Skip to content

Commit ab61a52

Browse files
committed
upgraded images from [String:String] to a typed Struct
1 parent 566ef72 commit ab61a52

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

swift/OpenClockStandard/ClockStandard.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,28 @@ import Foundation
1010

1111
public struct ClockWrapper: Codable {
1212
public var clockStandard: ClockStandard
13-
public var images: [[String:String]]
13+
public var assets: [ClockAsset]
1414

15-
public init(clockStandard: ClockStandard, images : [[String:String]]) {
15+
public init(clockStandard: ClockStandard, assets : [ClockAsset]) {
1616
self.clockStandard = clockStandard
17-
self.images = images
17+
self.assets = assets
1818
}
1919
}
2020

21+
public struct ClockAsset: Codable {
22+
23+
internal init(imageData: String = "", filename: String = "", hasTransparency: Bool = true) {
24+
self.imageData = imageData
25+
self.filename = filename
26+
self.hasTransparency = hasTransparency
27+
}
28+
29+
30+
public var imageData: String = ""
31+
public var filename: String = ""
32+
public var hasTransparency: Bool = true //use PNG or JPG decoding
33+
}
34+
2135
public struct ClockStandard: Codable {
2236
public var version = "1.0" //version of the models
2337
public var title: String

0 commit comments

Comments
 (0)