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
| // I really like this one | |
| // XCode 7.0 beta 6 (7A192o) | |
| typealias D = NonObjectiveCBase | |
| func ~=(left: Any, right: Bool) -> BooleanType { | |
| return 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
| // I really like this one | |
| // XCode 7.0 beta 6 (7A192o) | |
| func ~=(left: Any, right: Bool) -> BooleanType { | |
| return true | |
| } | |
| func +(left: Any, right: Any) -> String { | |
| return "" |
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
| // | |
| // AsyncTests.swift | |
| // | |
| import XCTest | |
| // MARK: Async Helper Extension | |
| extension XCTestCase { | |
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 Service { } | |
| protocol ServiceLocatorProtocol { | |
| func provideService() -> Service | |
| } |
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 StructServiceLocator: ServiceLocatorProtocol { | |
| static var sharedInstance = StructServiceLocator() | |
| private init() { } | |
| func provideService() -> Service { | |
| return Service() | |
| } | |
| } |
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
| enum EnumServiceLocator: ServiceLocatorProtocol { | |
| case sharedInstance | |
| func provideService() -> Service { | |
| return Service() | |
| } | |
| } | |
| EnumServiceLocator.sharedInstance.provideService() |
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
| func ==<T: CollectionType where T.Generator.Element: Equatable>(lhs: T, rhs: T) -> Bool { | |
| return lhs.count == rhs.count && !(zip(lhs, rhs).contains { $0.0 != $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 | |
| import XCPlayground | |
| import UIKit | |
| final public class GradientView: UIView { | |
| override public class func layerClass() -> AnyClass { | |
| return CAGradientLayer.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
| One last thing, as a bonus, is we have CATransitions. You’ll notice in a number of these animations that the text transitions between states is in a little bit more of an elegant fashion than our normal set text. Set text is very effective, but when you replace the text within about one frame, it’s very jarring. When you’re fading colors around your text, we really want to consider fading the text as well. | |
| extension CATransition { | |
| static func simpleFade() -> CATransition { | |
| let fadeTransition = CATransition() | |
| fadeTransition.duration = 0.125 | |
| fadeTransition.type = kCATransitionFade | |
| fadeTransition.timingFunction = CAMediaTimingFunction( | |
| name: kCAMediaTimingFunctionEaseInEaseOut) | |
| return fadeTransition |
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 | |
| class Node<T> { | |
| let value: T | |
| var next: Node<T>? | |
| init(value: T) { |
OlderNewer