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 CocoaLumberjack; | |
| @interface DDCLSLogger : DDAbstractLogger | |
| @end |
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
| extension Collection { | |
| func eachConsecutive(_ size: Int) -> Array<SubSequence> { | |
| let droppedIndices = indices.dropFirst(size - 1) | |
| return zip(indices, droppedIndices) | |
| .map { return self[$0...$1] } | |
| } | |
| } |
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 | |
| class MyView: UIView { | |
| fileprivate var myPreviewInteraction: Any? = nil | |
| init() { | |
| super.init(frame: CGRect.zero) | |
| if #available(iOS 10.0, *) { | |
| myPreviewInteraction = UIPreviewInteraction(view: self) |
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
| // | |
| // CoreDataController.swift | |
| // | |
| // Created by Keith Harrison http://useyourloaf.com | |
| // Copyright (c) 2017 Keith Harrison. All rights reserved. | |
| // | |
| // Redistribution and use in source and binary forms, with or without | |
| // modification, are permitted provided that the following conditions are met: | |
| // | |
| // 1. Redistributions of source code must retain the above copyright |
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/Foundation.h> | |
| @interface AuthContextSecureEnclaveKeychain : NSObject | |
| - (instancetype)initWithIdentifier:(NSString *)identifier userPrompt:(NSString *)userPrompt; | |
| - (NSString *)stringForKey:(NSString *)key; | |
| - (BOOL)setString:(NSString *)string forKey:(NSString *)key; |
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 | |
| import PlaygroundSupport | |
| public extension UIColor { | |
| public func hsba() -> (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat)? { | |
| var hue: CGFloat = .nan, saturation: CGFloat = .nan, brightness: CGFloat = .nan, alpha: CGFloat = .nan | |
| guard self.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha) else { | |
| return nil | |
| } | |
| return (hue: hue, saturation: saturation, brightness: brightness, alpha: alpha) |
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 | |
| struct Country { | |
| let name: String | |
| let capital: String | |
| var visited: Bool | |
| } | |
| extension Country: Equatable { | |
| static func == (lhs: Country, rhs: Country) -> Bool { |
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
| extension Comparable { | |
| /// Returns a Boolean value indicating whether a value is included in a | |
| /// range. | |
| /// | |
| /// You can use this pattern matching operator (`~=`) to test whether a value | |
| /// is included in a range. The following example uses the `~=` operator to | |
| /// test whether an integer is included in a range of single-digit numbers. | |
| /// | |
| /// let chosenNumber = 3 | |
| /// if chosenNumber ~= 0...9 { |
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
| @objc protocol Refreshable | |
| { | |
| /// The refresh control | |
| var refreshControl: UIRefreshControl? { get set } | |
| /// The table view | |
| var tableView: UITableView! { get set } | |
| /// the function to call when the user pulls down to refresh | |
| @objc func handleRefresh(_ sender: Any); |
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 a: Double? = 1.0 | |
| let b: Double? = 2.0 | |
| let c: Double? = 3.0 | |
| let d: Double? = 4.0 | |
| let e: Double? = 5.0 | |
| let f: Double? = 6.0 | |
| let g: Double? = 7.0 | |
| extension Optional { | |
| func `or`(_ value : Wrapped?) -> Optional { |