This file contains hidden or 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
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 { |
This file contains hidden or 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
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)) | |
} |
This file contains hidden or 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
// | |
// 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 |