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 let selectedIndexPath = methodsTableView?.indexPathForSelectedRow { | |
if let coordinator = transitionCoordinator { | |
coordinator.animate(alongsideTransition: { context in | |
self.methodsTableView?.deselectRow(at: selectedIndexPath, animated: true) | |
}) { context in | |
if context.isCancelled { | |
self.methodsTableView?.selectRow(at: selectedIndexPath, animated: false, scrollPosition: .none) | |
} | |
} | |
} else { |
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 | |
/// An object that wraps a single value and publishes a new element whenever the value changes. | |
@propertyWrapper struct CurrentValue<Output> { | |
private let publisher = BasicPublisher() | |
var value: Output { | |
didSet { | |
publisher.handler?(oldValue, wrappedValue) | |
} |
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 | |
import XCTest | |
extension Collection where Indices.Iterator.Element == Index { | |
subscript(safe index: Index) -> Iterator.Element? { | |
return indices.contains(index) ? self[index] : nil | |
} | |
} | |
class PerfomanceTester: XCTestCase { |
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 CoreData | |
protocol SingleFetchedResultsControllerDelegate: class { | |
func controller(didChange anObject: NSFetchRequestResult, for type: SingleFetchedResultsChangeType) | |
func controller(error: SingleFetchedResultsControllerError) | |
} | |
extension SingleFetchedResultsControllerDelegate { | |
func controller(_ controller: SingleFetchedResultsController<NSFetchRequestResult>, error: SingleFetchedResultsControllerError) { } | |
} |
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 | |
public extension UIColor { | |
/// Initializes and returns a color object using the specified hex value | |
/// | |
/// - Parameter hex: hex value, example: `#ffffff` or `ffffff` | |
public convenience init(hex: String) { | |
let hexString = hex.trimmingCharacters(in: .whitespacesAndNewlines) | |
let scanner = Scanner(string: hexString) |
NewerOlder