mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-12 09:26:26 +01:00
34 lines
671 B
Swift
34 lines
671 B
Swift
//
|
|
// TwitterURL.swift
|
|
// Account
|
|
//
|
|
// Created by Maurice Parker on 4/18/20.
|
|
// Copyright © 2020 Ranchero Software, LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
struct TwitterURL: Codable, TwitterEntity {
|
|
|
|
let url: String?
|
|
let indices: [Int]?
|
|
let displayURL: String?
|
|
let expandedURL: String?
|
|
|
|
enum CodingKeys: String, CodingKey {
|
|
case url = "url"
|
|
case indices = "indices"
|
|
case displayURL = "display_url"
|
|
case expandedURL = "expanded_url"
|
|
}
|
|
|
|
func renderAsHTML() -> String {
|
|
var html = String()
|
|
if let expandedURL = expandedURL, let displayURL = displayURL {
|
|
html += "<a href=\"\(expandedURL)\">\(displayURL)</a>"
|
|
}
|
|
return html
|
|
}
|
|
|
|
}
|