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
// USAGE: | |
// Call RestorationDefender.printViewControllerClassesThatAreProbablyNotRestorable() to print a list of view controllers that will probably not return from state restoration. | |
// Call RestorationDefender.crashWhenViewControllersDoNotImplementStateRestoration() to crash your app when a view controller appears without setting restorationIdentifier and restorationClass. | |
// Call RestorationDefender.shoutWhenViewControllersDoNotImplementStateRestoration() to print a big message when a view controller appears without setting restorationIdentifier and restorationClass. | |
import Foundation | |
private func objc_getClassList() -> [AnyClass] { | |
let expectedClassCount = objc_getClassList(nil, 0) | |
var allClasses = UnsafeMutablePointer<AnyClass?>.alloc(Int(expectedClassCount)) |
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 | |
protocol Completable { | |
func addCompletionOperation(on queue: OperationQueue, complete: @escaping (Self) -> Void) -> Operation | |
} | |
extension Completable where Self: Operation { | |
func addCompletionOperation(on queue: OperationQueue, complete: @escaping (Self) -> Void) -> Operation { | |
let completionOperation = BlockOperation { |
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
// | |
// SEUIChildManagingViewController.swift | |
// ThreePanelSplitViewController | |
// | |
// Created by Brian Nickel on 6/21/17. | |
// Copyright © 2017 Brian Nickel. 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
fileprivate func replaceAndExpandComments(_ comments:[SEAPIComment], includeUpdates:Bool) { | |
let originalComments = displayedComments | |
let changes = compare(original: displayedComments.map({ $0.commentId }), modified: comments.map({ $0.commentId })) | |
self.comments = comments | |
self.displayedComments = comments | |
var changedIndexPaths:[IndexPath] = [] | |
var deletedIndexPaths:[IndexPath] = [] |
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/UIKit.h> | |
IB_DESIGNABLE | |
@interface SEUIEnlargedTapRadiusCollectionView : UICollectionView | |
@property (nonatomic, assign) IBInspectable CGFloat enlargedTapRadius; | |
@end |
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/Foundation.h> | |
NS_ASSUME_NONNULL_BEGIN | |
@interface SETableViewBatchUpdate : NSObject | |
- (instancetype)init NS_UNAVAILABLE; | |
- (instancetype)initWithTableView:(UITableView *)tableView NS_DESIGNATED_INITIALIZER; | |
- (void)runAnimated:(BOOL)animated completion:(void (^ _Nullable)())completion; | |
@property (nonatomic, assign, readonly) BOOL hasUpdates; | |
@end |
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; | |
@interface SEPrankster: NSObject | |
@property (class, readonly) SEPrankster *sharedPrankser; | |
- (void)setUpFontRandomness:(BOOL)run; | |
- (void)setFontCategory:(UIContentSizeCategory)category; | |
@end |
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 | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
window = UIWindow(frame: UIScreen.main.bounds) |
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 Security | |
import Foundation | |
// MARK: - Redefining boilerplate code | |
func SecKeychainOpen(path:String) -> SecKeychainRef? { | |
var keychain:Unmanaged<SecKeychainRef>? = nil | |
if SecKeychainOpen((path as NSString).UTF8String, &keychain) == errSecSuccess { | |
return keychain?.takeRetainedValue() |
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
func eventuallyAdd(_ viewControllers: [UIViewController], to navigationController: UINavigationController) { | |
if canAdd(viewControllers, to: navigationController) { | |
navigationController.viewControllers += viewControllers | |
} else { | |
// SHOW PLACEHOLDER CONTENT HERE IF NEEDED | |
DispatchQueue.main.async { | |
eventuallyAdd(viewControllers, to: navigationController) | |
} |
NewerOlder