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
// swift 4.1 | |
protocol AnyEquatable { | |
func isEqual(to value: Any) -> Bool | |
} | |
extension AnyEquatable where Self: Equatable { | |
func isEqual(to value: Any) -> Bool { | |
guard let value = value as? Self else { | |
return false |
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 | |
let data = """ | |
{ | |
"version": "1.0", | |
"type": "photo", | |
"width": 240, | |
"height": 160, | |
"title": "ZB8T0193", | |
"url": "http://farm4.static.flickr.com/3123/2341623661_7c99f48bbf_m.jpg", |
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
struct List<Element>: Sequence, Collection where Element: Hashable { | |
private var contents: [[Element]] | |
init(_ sections: [[Element]] = [[]]) { | |
contents = sections | |
} | |
// MARK: - Sequence | |
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 | |
extension UIColor { | |
struct HSBA { | |
var hue: CGFloat | |
var saturation: CGFloat | |
var brightness: CGFloat | |
var alpha: CGFloat | |
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
// Swift 4.0.3 | |
import Foundation | |
extension NSRange: SurrogatePairAdjustable { | |
func adjusted(for pairs: [String.SurrogatePair]) -> NSRange { | |
if pairs.isEmpty { | |
return 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
#import <WebKit/WebKit.h> | |
@protocol PRSProgressDelegate <NSObject> | |
- (void)setNavigationTitle:(NSString *)title; | |
- (void)setProgress:(CGFloat)progress animated:(BOOL)animated; | |
- (void)setVisible:(BOOL)visible animated:(BOOL)animated; | |
@end |
NewerOlder