Skip to content

Commit

Permalink
♻️ (ContentKit): Move UIElementType to Exercise
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Nov 13, 2023
1 parent 93a35f5 commit 28922af
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public enum DragAndDropAssociation {

public struct Choice: Codable {
public let value: String
public let type: UIElementType
public let type: Exercise.UIElementType
public let catergory: Catergory?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public enum DragAndDropIntoZones {

public struct Details: Codable {
public let value: String
public let type: UIElementType
public let type: Exercise.UIElementType
}
}

public struct Choice: Codable {
public let value: String
public let type: UIElementType
public let type: Exercise.UIElementType
public let dropZone: DropZone?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public enum TouchAssociation {

public struct Choice: Codable {
public let value: String
public let type: UIElementType
public let type: Exercise.UIElementType
public let catergory: Catergory?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public enum TouchSelection {

public struct Choice: Codable {
public let value: String
public let type: UIElementType
public let type: Exercise.UIElementType
public let isRightAnswer: Bool

private enum CodingKeys: String, CodingKey {
Expand All @@ -18,11 +18,11 @@ public enum TouchSelection {
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
value = try container.decode(String.self, forKey: .value)
type = try container.decode(UIElementType.self, forKey: .type)
type = try container.decode(Exercise.UIElementType.self, forKey: .type)
isRightAnswer = try container.decodeIfPresent(Bool.self, forKey: .isRightAnswer) ?? false
}

public init(value: String, type: UIElementType, isRightAnswer: Bool = false) {
public init(value: String, type: Exercise.UIElementType, isRightAnswer: Bool = false) {
self.value = value
self.type = type
self.isRightAnswer = isRightAnswer
Expand Down
15 changes: 15 additions & 0 deletions Modules/ContentKit/Sources/Exercise/Exercise+UIElement.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Leka - iOS Monorepo
// Copyright 2023 APF France handicap
// SPDX-License-Identifier: Apache-2.0

import Foundation

extension Exercise {

public enum UIElementType: String, Codable {
case image
case text
case color
}

}
10 changes: 5 additions & 5 deletions Modules/ContentKit/Sources/Exercise/Exercise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public struct Exercise: Codable {

}

public enum UIElementType: String, Codable {
case image
case text
case color
}
//public enum UIElementType: String, Codable {

Check failure on line 31 in Modules/ContentKit/Sources/Exercise/Exercise.swift

View workflow job for this annotation

GitHub Actions / lint

Prefer at least one space after slashes for comments (comment_spacing)
// case image
// case text
// case color
//}

Check failure on line 35 in Modules/ContentKit/Sources/Exercise/Exercise.swift

View workflow job for this annotation

GitHub Actions / lint

Prefer at least one space after slashes for comments (comment_spacing)

0 comments on commit 28922af

Please sign in to comment.