Skip to content

Commit

Permalink
Add enum for FDTextContainerType
Browse files Browse the repository at this point in the history
  • Loading branch information
bilaalrashid committed May 31, 2024
1 parent d7358a1 commit 7c79cb1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/BbcNews/Models/Story/Text/FDTextContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct FDTextContainer: Codable, Equatable, Hashable {
internal let type: String

/// The type of the container that the text should be displayed in.
public var containerType: String
public var containerType: FDTextContainerType

/// The text to be displayed in the paragraph.
public var text: FDAttributedText
Expand All @@ -23,7 +23,7 @@ public struct FDTextContainer: Codable, Equatable, Hashable {
/// - Parameters:
/// - containerType: The type of the container that the text should be displayed in.
/// - text: The text to be displayed in the paragraph.
public init(containerType: String, text: FDAttributedText) {
public init(containerType: FDTextContainerType, text: FDAttributedText) {
self.type = "textContainer"
self.containerType = containerType
self.text = text
Expand Down
17 changes: 17 additions & 0 deletions Sources/BbcNews/Models/Story/Text/FDTextContainerType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// FDTextContainerType.swift
// BbcNews
//
// Created by Bilaal Rashid on 26/05/2024.
//

import Foundation

/// A type of a text container.
public enum FDTextContainerType: String, Codable, Equatable, Hashable, Unknownable {
case introduction
case body
case crosshead

case unknown
}

0 comments on commit 7c79cb1

Please sign in to comment.