30 lines
535 B
Swift
Raw Normal View History

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