MDChapter

public struct MDChapter
extension MDChapter: Decodable
extension MDChapter: Encodable

Structure representing a manga chapter returned by MangaDex This is passed in the data property of an MDObject

  • The chapter’s title

    Declaration

    Swift

    public let title: String
  • The volume this chapter belongs to, if entered by the uploader

    Declaration

    Swift

    public let volume: String?
  • The chapter in the printed manga which corresponds to this chapter

    Note

    This may be nil string if the uploader did not provide a chapter number (e.g. for oneshots)

    Declaration

    Swift

    public let chapter: String?
  • The language in which this chapter was translated

    Declaration

    Swift

    public let language: Locale?
  • The chapter’s hash, used to fetch the pages when using MangaDex@Home

    Declaration

    Swift

    public let hash: String
  • The list of page file names

    Use getPageUrls to get the list of URLs for these files

    Declaration

    Swift

    public let pages: [String]
  • The list of low resolution page file names

    Use getPageUrls and set the lowRes parameter to true to get the list of URLs for these files

    Declaration

    Swift

    public let pagesLowRes: [String]
  • The date at which this chapter entry was created on MangaDex

    Declaration

    Swift

    public let createdDate: Date
  • The date of the last update made to this chapter entry on MangaDex

    Note

    This property will be nil if the chapter was never modified after being created

    Declaration

    Swift

    public let updatedDate: Date?
  • The date at which this chapter will be or has been published

    Note

    This may differ from the createdDate property as scanlation groups might impose delays

    Declaration

    Swift

    public let publishDate: Date?
  • The version of this type of object in the MangaDex API

    Declaration

    Swift

    public let version: Int
  • The list of page URLs for this chapter using the specified node

    Declaration

    Swift

    public func getPageUrls(node: MDAtHomeNode, lowRes: Bool = false) -> [URL]

    Parameters

    node

    The MD@Home node serving the images

    lowRes

    Whether to get the low resolution version of the image or not

  • The list of page URLs for this chapter using the specified “official” image server

    Declaration

    Swift

    public func getPageUrls(node: MDImageServer, lowRes: Bool = false) -> [URL]

    Parameters

    node

    The image server serving the images

    lowRes

    Whether to get the low resolution version of the image or not

  • Custom init implementation to handle decoding the language attribute

    Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Convenience init used for update endpoints

    Declaration

    Swift

    public init(title: String,
                volume: String? = nil,
                chapter: String? = nil,
                language: Locale,
                pages: [String],
                pagesLowRes: [String])
  • Custom encode implementation to handle encoding the language attribute

    The MangaDex API does not expect the same thing when encoding an MDChapter as when decoding it, which makes this a bit awkward. See https://api.mangadex.org/docs.html#operation/put-chapter for more details

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws