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
/* | |
Xcode 8 beta 6 | |
Apple Swift version 3.0 (swiftlang-800.0.43.6 clang-800.0.38) | |
Target: x86_64-apple-macosx10.9 | |
*/ | |
struct Generic<A, B> {} | |
//if typealias is defined inside the concrete type it works: | |
class SomeClass { |
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
public final class Box<T> { | |
public let value: T | |
public init(value: T) { | |
self.value = value | |
} | |
} | |
public final class NSCodingBox<T: Coding>: NSObject, NSCoding { | |
public let value: T | |
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
public protocol Stylish: class { | |
func updateStyle() | |
} | |
public class StyleProxy<S: Stylish>: NSObject { | |
fileprivate override init() { } | |
} | |
private class StyleProxyView<S: Stylish>: UIView { | |
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 UIVisualEffectView { | |
private var filterLayer: CALayer? { | |
return layer.sublayers?.first | |
} | |
private var blurFilter: NSObject? { | |
return filterLayer? | |
.filters?.flatMap({ $0 as? NSObject }) | |
.first(where: { $0.value(forKey: "name") as? String == "gaussianBlur" }) |
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 XCTest | |
import Ambassador | |
import Embassy | |
class EmbassyRedirectUITests: XCTestCase { | |
var app: XCUIApplication! | |
var router: Router! | |
private var eventLoop: EventLoop! |
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
// The issue with sectionHeadersPinToVisibleBounds and sectionFootersPinToVisibleBounds is that they do not pin | |
// first header and last footer when bouncing. This layout subclass fixes that. | |
class StickyLayout: UICollectionViewFlowLayout { | |
override init() { | |
super.init() | |
self.sectionFootersPinToVisibleBounds = true | |
self.sectionHeadersPinToVisibleBounds = true | |
} |
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
!/bin/sh | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
FILES=($(git ls-files -m | grep ".*\.swift$" | grep -v ".*R.generated.swift$")) | |
if [[ ${FILES[@]} ]]; then | |
export "SCRIPT_INPUT_FILE_COUNT"="${#FILES[@]}" | |
for i in "${!FILES[@]}"; do | |
export "SCRIPT_INPUT_FILE_$i"="${FILES[$i]}" | |
done |
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
//: Playground - noun: a place where people can play | |
import Foundation | |
final class Disposable { | |
private let dispose: () -> () | |
init(_ dispose: @escaping () -> ()) { | |
self.dispose = dispose | |
} | |
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
// First make sure that you have granted access to Automator, Xcode and Paw in accessibility section in Security & Privacy settings. | |
// Then create a new Service workflow in Automator with following actions: | |
1. Copy to clipboard | |
2. Launch Application: "Paw" | |
3. Run AppleScript: | |
tell application "System Events" | |
tell process "Paw" | |
click menu item "Text" of menu 1 of menu item "Import" of menu 1 of menu bar item "File" of menu bar 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
/* | |
Instead of using enum it's possible to use RawRepresentable struct that will give you support for "unsupported" values, | |
but will cost you excastive switches (you'll alwyas have to handle default case, which will stand for those "unsupported" values) | |
It's defenetely more code than if using optional, but might be better if it comes to unwrapping this value everywhere. | |
*/ | |
//enum System: String, Decodable { | |
// case ios, macos, tvos, watchos | |
//} | |
struct System: RawRepresentable, Decodable { |