Skip to content

Instantly share code, notes, and snippets.

View fdiaz's full-sized avatar

Francisco Diaz fdiaz

View GitHub Profile
@fdiaz
fdiaz / DecisionNode.swift
Last active March 6, 2020 19:53
Decision tree for module types
#!/usr/bin/swift
import Foundation
// Models
indirect enum DecisionNode {
case option(Option)
case terminal(Terminal)
}
@fdiaz
fdiaz / TypeConformanceInspector.swift
Last active April 18, 2021 14:09
Example usage of SyntaxRewriter/SyntaxVisitor
import Foundation
import SwiftSyntax // Using 0.50000.0
// Helper
struct Temporary {
static func makeSwiftFile(withContent content: String) throws -> URL {
let temporaryDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory(),
isDirectory: true)
let fileName = UUID().uuidString + ".swift"
let temporaryFileURL =
@fdiaz
fdiaz / GameView.swift
Last active June 9, 2019 23:31
Usage of Binding.constant for previews
//
// GameView.swift
// Tilt
//
// Created by Francisco Díaz on 08-06-19.
// Copyright © 2019 Francisco Diaz. All rights reserved.
//
import SwiftUI
@fdiaz
fdiaz / StyleType.swift
Created December 16, 2015 00:39
Style UINavigationBar using protocol extensions
internal protocol StyleType {
var tintColor: UIColor { get }
}
internal struct SomeStyle: StyleType {
let tintColor = UIColor.redColor()
}
internal struct SomeOtherStyle: StyleType {
let tintColor = UIColor.whiteColor()