NetNewsWire/Frameworks/Account/FeedProvider/Twitter/TwitterMention.swift

34 lines
652 B
Swift
Raw Normal View History

2020-04-18 19:03:16 +02:00
//
// TwitterMention.swift
// Account
//
// Created by Maurice Parker on 4/18/20.
// Copyright © 2020 Ranchero Software, LLC. All rights reserved.
//
import Foundation
2020-04-20 02:19:39 +02:00
struct TwitterMention: Codable, TwitterEntity {
2020-04-18 19:03:16 +02:00
let name: String?
let indices: [Int]?
let screenName: String?
let idStr: String?
enum CodingKeys: String, CodingKey {
case name = "url"
case indices = "indices"
case screenName = "screen_name"
case idStr = "idStr"
}
2020-04-20 02:19:39 +02:00
func renderAsHTML() -> String {
var html = String()
if let screenName = screenName {
html += "<a href=\"https://twitter.com/\(screenName)\">@\(screenName)</a>"
}
return html
2020-04-20 02:19:39 +02:00
}
2020-04-18 19:03:16 +02:00
}