Skip to content

Instantly share code, notes, and snippets.

View mflint's full-sized avatar

Matthew Flint mflint

View GitHub Profile
@mflint
mflint / StringExtension.swift
Created August 29, 2018 19:15
A hacky String extension to convert html into NSAttributedString. Very Mastodon-specific. Very ugly.
import Foundation
extension String {
class HtmlComponent {
var parent: HtmlComponent?
var children = [HtmlComponent]()
init(parent: HtmlComponent? = nil) {
self.parent = parent
}
@mflint
mflint / DeparturesViewController.swift
Created January 26, 2019 13:02
data-driven screen dispatching for iOS
class DeparturesViewController: UIViewController, ViewController {
private var viewModel: DeparturesViewModel!
func accept(_ viewModel: ViewModel) {
self.viewModel = viewModel as? DeparturesViewModel
}
}