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 { | |
public func firstMap<T>(where predicate: (Element) throws -> T?) rethrows -> T? { | |
for element in self { | |
if let value = try predicate(element) { | |
return value | |
} | |
} | |
return nil | |
} | |
} |
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
#!/usr/bin/swift | |
import Foundation | |
import RegexBuilder | |
var lines: [String] = [] | |
while let line = readLine() { | |
lines.append(line) | |
} |
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 | |
import UIKit | |
extension String { | |
var attributedString: NSAttributedString { | |
return NSAttributedString(string: 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
// | |
// UIView+WR_ExtendedBlockAnimations.h | |
// Wire | |
// | |
// Created by Jacob Persson on 29/07/15. | |
// Copyright (c) 2015 Wire Swiss GmbH. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
#import <RBBAnimation/RBBEasingFunction.h> |