mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
create ArticleCOntent model
This commit is contained in:
parent
e28cf07666
commit
1b6fb7ba93
1 changed files with 22 additions and 0 deletions
22
apple/OmnivoreKit/Sources/Models/ArticleContent.swift
Normal file
22
apple/OmnivoreKit/Sources/Models/ArticleContent.swift
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import Foundation
|
||||
|
||||
public struct ArticleContent {
|
||||
public let htmlContent: String
|
||||
public let highlights: [Highlight]
|
||||
|
||||
public init(
|
||||
htmlContent: String,
|
||||
highlights: [Highlight]
|
||||
) {
|
||||
self.htmlContent = htmlContent
|
||||
self.highlights = highlights
|
||||
|
||||
print(highlightsJSONString)
|
||||
}
|
||||
|
||||
public var highlightsJSONString: String {
|
||||
let jsonData = try? JSONEncoder().encode(highlights)
|
||||
guard let jsonData = jsonData else { return "[]" }
|
||||
return String(data: jsonData, encoding: .utf8) ?? "[]"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue