Skip to content

Instantly share code, notes, and snippets.


Mycroft Canner mycroftcanner

  • Romanova
View GitHub Profile
mycroftcanner / HostingNode.swift
Created Oct 21, 2019
Wraps a SwiftUI View inside a ASDisplayNode
View HostingNode.swift
// HostingNode.swift
import AsyncDisplayKit
import SwiftUI
class HostingNode: ASDisplayNode {
var viewController: UIViewController?
View webView.swift
let userScript = WKUserScript(source: source,
injectionTime: .atDocumentEnd,
forMainFrameOnly: true)
let userContentController = WKUserContentController()
let configuration = WKWebViewConfiguration()
configuration.userContentController = userContentController
View gist:a272cdbb97182063e66a8f86d24ebde9
return configure(WKWebView(
frame: .zero,
configuration: configure(WKWebViewConfiguration()) {
$0.userContentController = configure(WKUserContentController()) {
source: source,
injectionTime: .atDocumentEnd,
forMainFrameOnly: true
mycroftcanner / SwiftUINavViewTabViewAppearance.swift
Created Oct 3, 2019
SwiftUI hack: NavigationView and TabView's appearance
View SwiftUINavViewTabViewAppearance.swift
// SwiftUI hack: NavigationView and TabView's appearance
import UIkit
extension UINavigationController {
override open func viewDidAppear(_ animated: Bool) {
let appearance = UINavigationBarAppearance()
navigationBar.standardAppearance = appearance