Skip to content

Commit 3fee5f7

Browse files
committed
fix: default values for options
2 parents c0624d5 + 4f3a999 commit 3fee5f7

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

Sources/IONCameraLib/Models/IONCAMRMediaOptions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class IONCAMRMediaOptions: IONCAMREditMediaTypeOptionsDelegate, IONCAMRSa
1919
}
2020

2121
/// Camera to be used.
22-
public enum IONCAMRDirection: Int, Decodable {
23-
case back = 0
24-
case front
22+
public enum IONCAMRDirection: String, Decodable {
23+
case back = "REAR"
24+
case front = "FRONT"
2525
}

Sources/IONCameraLib/Models/IONCAMRTakePhotoOptions.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ public class IONCAMRTakePhotoOptions: IONCAMRMediaOptions, Decodable {
4141
throw throwError(field: "encodingType")
4242
}
4343

44-
let saveToGallery = try container.decodeIfPresent(Bool.self, forKey: .saveToGallery) ?? false
45-
guard
46-
let cameraDirection = IONCAMRDirection(rawValue: try container.decodeIfPresent(Int.self, forKey: .cameraDirection) ?? 0)
47-
else {
44+
let saveToGallery = try container.decode(Bool.self, forKey: .saveToGallery)
45+
guard
46+
let rawCameraDirection = try container.decodeIfPresent(String.self, forKey: .cameraDirection) ?? IONCAMRDirection.back.rawValue,
47+
let cameraDirection = IONCAMRDirection(rawValue: rawCameraDirection)
48+
else {
4849
throw throwError(field: "cameraDirection")
4950
}
5051

0 commit comments

Comments
 (0)