๐
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
+ (BOOL)migrateStoreAtURL:(NSURL *)storeURL | |
models:(NSArray<NSManagedObjectModel *> *)moms // @[ mom_v1, mom_v2, mom_v3 ... ]; | |
error:(NSError **)error { | |
// Find an index of the current store's mom | |
NSDictionary *meta = [NSPersistentStoreCoordinator metadataForPersistentStoreOfType:NSSQLiteStoreType URL:storeURL error:error]; | |
if (!meta) { | |
return NO; | |
} | |
NSInteger idx = [moms indexOfObjectPassingTest:^BOOL(NSManagedObjectModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | |
return [obj isConfiguration:nil compatibleWithStoreMetadata:meta]; |
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
// | |
// MXSEventTrackingWindow.h | |
// | |
// Created by Max Seelemann on 01.09.16. | |
// Copyright ยฉ 2016 The Soulmen. All rights reserved. | |
// | |
/*! | |
@abstract Special window class used for advanced event processing. | |
*/ |
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
import UIKit | |
/// Fast, concrete text storage intended to be subclassed. | |
class BaseTextStorage: NSTextStorage { | |
// MARK: - Properties | |
private let storage = NSMutableAttributedString() | |
// MARK: - NSTextStorage |
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
Essential Xcode Shortcuts | |
๐บ๐ธ Keyboard | |
โ B Build | |
โ R Run | |
โ U Run Test | |
โง โ K Clean | |
โฅ โง โ K Clean Build Folder | |
โง โ O Open quickly |
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
// | |
// LCKConcurrentOperation.m | |
// LCKOperations | |
// | |
// Created by Twig on 12/19/13. | |
// Copyright (c) 2013 Lickability. All rights reserved. | |
// | |
#import "LCKConcurrentOperation.h" |
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
import Foundation | |
// A lens is a getter and a setter combined | |
struct Lens<Whole, Part> { | |
let get: (Whole) -> Part | |
let set: (inout Whole, Part) -> () | |
} | |
// We can create a lens from a key path | |
extension Lens { |
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
import Foundation | |
final class Sample: NSObject { | |
@objc dynamic var name: String = "" | |
} | |
class MyObj: NSObject { | |
@objc dynamic var test: String = "" | |
} | |
extension NSObjectProtocol where Self: NSObject { |
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
import Foundation | |
// Alternatives to `Scanner` (before: `NSScanner`). | |
// A scanner only needs a way to peek and to move to the next token. | |
protocol ScannerProtocol { | |
associatedtype Token: Equatable | |
var peek: Token? { get } | |
mutating func moveToNextToken() |
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
let emojis: [String: [String]] = [ | |
// +[EMFEmojiCategory TravelAndPlacesEmoji] | |
"travel": ["๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ด", "๐ฒ", "๐ต", "๐", "๐จ", "๐", "๐", "๐", "๐", "๐ก", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐ฉ", "โ๏ธ", "๐ซ", "๐ฌ", "๐", "๐ฐ", "๐บ", "๐ถ", "โต๏ธ", "๐ฅ", "๐ค", "๐ณ", "โด", "๐ข", "โ๏ธ", "๐ง", "โฝ๏ธ", "๐", "๐ฆ", "๐ฅ", "๐บ", "๐ฟ", "๐ฝ", "โฒ๏ธ", "๐ผ", "๐ฐ", "๐ฏ", "๐", "๐ก", "๐ข", "๐ ", "โฑ", "๐", "๐", "โฐ", "๐", "๐ป", "๐", "๐", "๐", "โบ๏ธ", "๐ค", "๐ฃ", "๐", "๐ญ", "๐ ", "๐ก", "๐", "๐", "๐ข", "๐ฌ", "๐ฃ", "๐ค", "๐ฅ", "๐ฆ", "๐จ", "๐ช", "๐ซ", "๐ฉ", "๐", "๐", "โช๏ธ", "๐", "๐", "๐", "โฉ", "๐พ", "๐", "๐", "๐ ", "๐", "๐ ", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐", "๐"], | |
// +[EMFEmojiCategory NatureEmoji] | |
"nature": ["๐ถ", "๐ฑ", "๐ญ", "๐น", "๐ฐ", "๐ฆ", "๐ป", "๐ผ", "๐จ", "๐ฏ", "๐ฆ", "๐ฎ", "๐ท", "๐ฝ", "๐ธ", "๐ต", "๐", "๐", "๐", "๐", "๐", "๐ง", "๐ฆ", "๐ค", "๐ฃ", "๐ฅ", "๐ฆ", "๐ฆ ", "๐ฆ", "๐ฆ", "๐บ", "๐", "๐ด", "๐ฆ", "๐", "๐", "๐ฆ", "๐", "๐", "๐", "๐", "๐ท", "๐ธ", "๐ข", "๐", "๐ฆ", "๐ฆ", "๐ฆ", "๐ฆ", "๐", "๐ฆ", "๐ ", "๐", "๐ก", "๐ฌ", "๐ฆ |
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
import Foundation | |
extension String { | |
func hyphenated(languageCode: String) -> String { | |
let locale = Locale(identifier: languageCode) | |
return self.hyphenated(locale: locale) | |
} | |
func hyphenated(locale: Locale) -> String { |