Skip to content

Instantly share code, notes, and snippets.

View tonyarnold's full-sized avatar

Tony Arnold tonyarnold

View GitHub Profile
import SwiftUI
public struct ChangeObserver<V: Equatable>: ViewModifier {
public init(newValue: V, action: @escaping (V) -> Void) {
self.newValue = newValue
self.newAction = action
}
private typealias Action = (V) -> Void
@tonyarnold
tonyarnold / json.swift
Created November 13, 2017 23:41 — forked from rnapier/json.swift
Generic JSON Decodable
enum JSON: Decodable, CustomStringConvertible {
var description: String {
switch self {
case .string(let string): return "\"\(string)\""
case .number(let double):
if let int = Int(exactly: double) {
return "\(int)"
} else {
return "\(double)"
}
#if DEBUG
/**
Toggles assertion of Core Data managed object contexts. Only available when DEBUG is defined.
When enabled, your application will throw an exception when accessing or modifying entities in a context other than their own.
*/
void TCBToggleAssertingContextQueues();
#endif
#if DEBUG
/**
Toggles assertion of Core Data managed object contexts. Only available when DEBUG is defined.
When enabled, your application will throw an exception when accessing or modifying entities in a context other than their own.
*/
void TCBToggleAssertingContextQueues();
#endif
// NSManagedObjectContext+DebugSwizzling.h
#import <CoreData/CoreData.h>
#if DEBUG
/**
* Toggles debugging of Core Data managed object contexts.
*
* When enabled, will fire NSLogs in the following cases:
//
// RVNReceiptValidation.m
//
// Created by Satoshi Numata on 12/06/30.
// Copyright (c) 2012 Sazameki and Satoshi Numata, Ph.D. All rights reserved.
//
// This sample shows how to write the Mac App Store receipt validation code.
// Replace kRVNBundleID and kRVNBundleVersion with your own ones.
//
// This sample is provided because the coding sample found in "Validating Mac App Store Receipts"
Pod::Spec.new do |s|
s.name = "ReactiveCocoaIO"
s.version = "0.0.1"
s.summary = "Reactive file management framework built on top of ReactiveCocoa."
s.homepage = "https://github.com/ReactiveCocoa/ReactiveCocoaIO"
s.author = { "ReactiveCocoa" => "ReactiveCocoa" }
s.source = { :git => "https://github.com/zakdances/ReactiveCocoaIO.git", :commit => "7088c256fa55afe98dd60c880fa755fb4dc8265b" }
s.license = 'Simplified BSD License'
s.description = "ReactiveCocoaIO is a framework for accessing and manipulating a file system through signals, based on ReactiveCocoa."
@tonyarnold
tonyarnold / Peekaboo.h
Created May 15, 2012 07:11
How do i call a parent ViewController's method?
#import <UIKit/UIKit.h>
#import "ViewController.h"
@interface Peekaboo : UIView
@property (nonatomic, retain) ViewController *parentView;
- (void) show;
@end
@tonyarnold
tonyarnold / NASpinSegue.m
Created December 4, 2011 04:09 — forked from neilang/NASpinSegue.m
Spin Segue
#import "NASpinSegue.h"
@implementation NASpinSegue
- (void)perform{
UIViewController *sourceViewController = (UIViewController *)self.sourceViewController;
UIViewController *destinationViewController = (UIViewController *)self.destinationViewController;