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 | |
public protocol GSRegularExpressionMatchable { | |
func match(regex: GSRegex) -> Bool | |
func match(regex: NSRegularExpression) -> Bool | |
} | |
public class GSRegex: StringLiteralConvertible { | |
let regex: NSRegularExpression? | |
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
// | |
// CoreDataFetchController.swift | |
// | |
// Created by Scott Grosch on 12/18/14. | |
// Copyright (c) 2014 Gargoyle Software, LLC. All rights reserved. | |
// | |
import CoreData | |
final class CoreDataFetchController<T : NSManagedObject> { |
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
// Set<T> is a struct in Swift, meaning it passes by value, not reference. | |
// I had to create this so I could pass a Set to another view controller | |
// and have it actually modify the Set on the original view controller as | |
// there was only a Back button, not an OK/Done button in the interface. | |
func ==<T : Hashable>(lhs: BoxedSet<T>, rhs: BoxedSet<T>) -> Bool { | |
return lhs.set == rhs.set | |
} | |
final class BoxedSet<T : Hashable> : Hashable, CollectionType, ArrayLiteralConvertible { |
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
// | |
// GSPhotoPicker.swift | |
// TeamKnect | |
// | |
// Created by Scott Grosch on 10/18/14. | |
// Copyright (c) 2014 Gargoyle Software, LLC. All rights reserved. | |
// | |
import UIKit |
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
// | |
// NSManagedObjectContext.swift | |
// TeamKnect | |
// | |
// Created by Scott Grosch on 8/7/15. | |
// Copyright (c) 2015 Gargoyle Software, LLC. All rights reserved. | |
// | |
import UIKit | |
import CoreData |
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
#if os(iOS) | |
import UIKit | |
typealias _ViewController = UIViewController | |
typealias _StoryboardSegue = UIStoryboardSegue | |
#else | |
import Cocoa | |
typealias _ViewController = NSViewController | |
typealias _StoryboardSegue = NSStoryboardSegue | |
#endif |
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 | |
import CoreData | |
class Ticket: NSManagedObject { } | |
class TicketListViewController: UITableViewController { | |
var persistentCoordinator: NSPersistentContainer! | |
var tickets: [Ticket]! | |
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { |
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 SwiftUI | |
private class IntegerTextFieldValue: ObservableObject { | |
@Published var value = "" { | |
didSet { | |
let numbersOnly = value.filter { $0.isNumber } | |
if value != numbersOnly { | |
value = numbersOnly | |
} | |
} |