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
{} |
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
// | |
// DraggingValidator.swift | |
// Stash | |
// | |
// Created by Cory Sullivan on 2019-03-09. | |
// Copyright © 2019 Cory Sullivan. All rights reserved. | |
// | |
import Cocoa |
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
/// A thread safe class for managing an array of objects of a given type. The sequence holds | |
/// weak references to the contained objects, allowing them to be deallocated and | |
/// removed automatically. Order is maintained within the sequence. | |
class Listener<T> { | |
private let listeners: NSHashTable<AnyObject> = NSHashTable.weakObjects() | |
private let lockingQueue = DispatchQueue(label: "com.livelike.listenerSynchronizer", attributes: .concurrent) | |
func addListener(_ listener: T) { | |
lockingQueue.async(flags: .barrier) { [weak self] in | |
self?.listeners.add(listener as AnyObject) |
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
- (void)configureDefaults | |
{ | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
NSString *currencyCode = [[NSLocale currentLocale] objectForKey:NSLocaleCurrencyCode]; | |
NSNumber *selectedRow; | |
//On first open select the first item if a portfolio does exist | |
selectedRow = ([Portfolio MR_countOfEntities] > 0) ? @1 : @-1; | |
NSDictionary *standardDefaults = @{SBI_DEFAULT_CURRENCY:currencyCode, | |
kSelectedRow:selectedRow, |