MDManga
public struct MDManga
extension MDManga: Decodable
extension MDManga: Encodable
Structure representing a manga returned by MangaDex
This is passed in the data
property of an MDObject
-
The manga’s title
Declaration
Swift
public let title: MDLocalizedString
-
Alternative titles for this manga (e.g. when a manga is commonly known under multiple names)
Declaration
Swift
public let altTitles: [MDLocalizedString]
-
The manga’s description
Declaration
Swift
public let description: MDLocalizedString?
-
The original language in which this manga was published
Declaration
Swift
public let originalLanguage: Locale?
-
The volume in which the last chapter was published
Note
This can benil
if the last chapter hasn’t been uploaded. Bonus chapters do not countDeclaration
Swift
public let lastVolume: String?
-
A string indicating which chapter marks the end of the manga (usually represents a float, e.g. 142.5)
Note
This can benil
if the last chapter hasn’t been uploaded. Bonus chapters do not countDeclaration
Swift
public let lastChapter: String?
-
The demographic to which this manga is targeted
Declaration
Swift
public let demographic: MDDemographic?
-
The manga’s publication status
Declaration
Swift
public let publicationStatus: MDPublicationStatus?
-
The year this manga was created
Declaration
Swift
public let year: Int?
-
This manga’s content rating
Declaration
Swift
public let contentRating: MDContentRating?
-
The date at which this manga entry was created on MangaDex
Declaration
Swift
public let createdDate: Date
-
The date of the last update made to this manga entry on MangaDex
This property will be
nil
if the manga was never updated after being createdDeclaration
Swift
public let updatedDate: Date?
-
A set of links to external websites
Declaration
Swift
public let links: [MDExternalLink]
-
The version of this type of object in the MangaDex API
Declaration
Swift
public let version: Int
-
Custom
init
implementation to handle decoding theoriginalLanguage
andlinks
attributesDeclaration
Swift
public init(from decoder: Decoder) throws
-
init(title:
altTitles: description: authors: artists: links: originalLanguage: lastVolume: lastChapter: demographic: publicationStatus: year: contentRating: modNotes: ) Convenience
init
used for create/update endpointsDeclaration
Swift
public init(title: MDLocalizedString, altTitles: [MDLocalizedString], description: MDLocalizedString, authors: [String], artists: [String], links: [MDExternalLink], originalLanguage: Locale, lastVolume: String? = nil, lastChapter: String? = nil, demographic: MDDemographic? = nil, publicationStatus: MDPublicationStatus? = nil, year: Int? = nil, contentRating: MDContentRating? = nil, modNotes: String? = nil)
-
Custom
encode
implementation to handle encoding theoriginalLanguage
andlinks
attributesThe MangaDex API does not expect the same thing when encoding an
MDManga
as when decoding it, which makes this a bit awkward. See https://api.mangadex.org/docs.html#operation/post-manga for more detailsDeclaration
Swift
public func encode(to encoder: Encoder) throws