This file contains 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 UIKit | |
class SlotView: UIView { | |
enum Item { | |
case success | |
case failure | |
case number | |
} | |
This file contains 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
/// Withable is a simple protocol to make constructing | |
/// and modifying objects with multiple properties | |
/// more pleasant (functional, chainable, point-free) | |
public protocol Withable { | |
init() | |
} | |
public extension Withable { | |
/// Construct a new instance, setting an arbitrary subset of properties | |
init(with config: (inout Self) -> Void) { |
This file contains 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
#!/bin/sh | |
# This script embeds (and codesigns) a framework within an iOS app binary, but only when the configuration is Debug. | |
# It must be called from, or copied into an Xcode Run Script build phase with following setup: | |
# Input Files: | |
# - Path to framework within project folder (source path) | |
# - For example: $(SRCROOT)/ThirdPartyFrameworks/SimulatorStatusMagiciOS.framework | |
# Output Files: | |
# - Desired path to framework within ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH} (destination path) | |
# - For example: ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/SimulatorStatusMagiciOS.framework |
This file contains 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 Dispatch | |
private var throttleWorkItems = [AnyHashable: DispatchWorkItem]() | |
private var lastDebounceCallTimes = [AnyHashable: DispatchTime]() | |
private let nilContext: AnyHashable = arc4random() | |
public extension DispatchQueue { | |
/** | |
- parameters: | |
- deadline: The timespan to delay a closure execution |
This file contains 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
class BlurryOverlayView: UIVisualEffectView { | |
private var animator: UIViewPropertyAnimator! | |
private var delta: CGFloat = 0 // The amount to change fractionComplete for each tick | |
private var target: CGFloat = 0 // The fractionComplete we're animating to | |
private(set) var isBlurred = false | |
private var displayLink: CADisplayLink! | |
override init(effect: UIVisualEffect?) { | |
super.init(effect: effect) | |
setup() |
This file contains 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 UIKit | |
extension UIStackView { | |
func removeAllArrangedSubviews() { | |
let removedSubviews = arrangedSubviews.reduce([]) { (allSubviews, subview) -> [UIView] in | |
self.removeArrangedSubview(subview) | |
return allSubviews + [subview] | |
} |
This file contains 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
// | |
// DefaultingDecoder.swift | |
// | |
// Created by Michael Gray on 10/12/17. | |
// | |
import Foundation | |
// swiftlint:disable force_cast file_length |
This file contains 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
let a: Double? = 1.0 | |
let b: Double? = 2.0 | |
let c: Double? = 3.0 | |
let d: Double? = 4.0 | |
let e: Double? = 5.0 | |
let f: Double? = 6.0 | |
let g: Double? = 7.0 | |
extension Optional { | |
func `or`(_ value : Wrapped?) -> Optional { |
This file contains 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 | |
struct LocationData: Codable { | |
var city: String | |
var country: String | |
var address: String? | |
} | |
struct Item: Codable { | |
var name: String |
NewerOlder