Created
April 19, 2023 22:35
-
-
Save jtomchak/ab28cef7645e17f78b4b23a3504cac1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FontAwesomeIcon.swift | |
// Mastodon | |
// | |
// Created by Jesse Tomchak on 4/19/23. | |
// | |
import Foundation | |
struct IconStyle { | |
let title: String | |
let image: UIImage | |
} | |
enum FAIcon { | |
case mention | |
case message | |
} | |
extension FAIcon { | |
private var iconStyle: IconStyle { | |
switch self { | |
case .mention: | |
return IconStyle(title: "Mention", image: FontAwesome.image(fromChar: "\u{40}")) | |
case .message: | |
return IconStyle(title: "Message", image: FontAwesome.image(fromChar: "\u{f0e0}")) | |
} | |
} | |
} | |
extension FAIcon { | |
var image: UIImage { | |
return iconStyle.image | |
} | |
var title: String { | |
return iconStyle.title | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment