Skip to content

Instantly share code, notes, and snippets.

View thecoolwinter's full-sized avatar

Khan Winter thecoolwinter

View GitHub Profile
@thecoolwinter
thecoolwinter / ExtraCodable.swift
Created March 16, 2021 21:28
Helper methods for working with Codable objects and JSON Data and dictionaries. Provides two initializers and two methods for creating a Codable object using a dictionary or a Data object. And two methods for retreiving a dictionary or Data from the Codable instance.
//
// ExtraCodable.swift
//
// Created by Khan Winter on 3/16/21.
// Copyright © 2021 WindChillMedia. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@thecoolwinter
thecoolwinter / PercentageField.swift
Last active February 10, 2022 18:28
UITextField that automatically formats a percentage as a user types. It limits the input, and can return a value without any string formatting.
//
// PercentageField.swift
//
// Created by Khan Winter on 8/16/20.
//
import UIKit
class PercentageField: UITextField {
import Foundation
public class CodableStorage {
fileprivate init() { }
enum Directory {
case documents
case caches
case shared // Use for sharing files between containers. Eg, with an app extension.