Skip to content

Instantly share code, notes, and snippets.

import SwiftUI
import UIKit
enum ScalableFont {
case system(size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default)
case custom(_ name: String, size: CGFloat)
var size: CGFloat {
@loganmoseley
loganmoseley / transducer-type.swift
Last active October 18, 2020 16:57 — forked from mbrandonw/transducer-type.swift
How to get a transducer type without higher kinds
import Foundation
// A bunch of convenience things
func const <A, B> (_ b: B) -> (A) -> B {
return { _ in b }
}
func `repeat` <A> (_ n: Int) -> (A) -> [A] {
return { a in
Array(1...n).map(const(a))
}
//
// CDZIdioms.h
// https://www.dzombak.com/blog/2015/02/Tiny-Swift-idioms-in-ObjC.html
//
// Created by Chris Dzombak on 3/21/15.
// Copyright (c) 2015 Chris Dzombak. All rights reserved.
//
#ifndef CDZIdioms_h
#define CDZIdioms_h