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 data = error.userInfo![AFNetworkingOperationFailingURLResponseDataErrorKey] as NSData | |
| consoleLog(NSString(data: data, encoding: NSUTF8StringEncoding)) |
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
| Play Store | |
| Books & Reference | |
| Business | |
| Comics | |
| Communication | |
| Education | |
| Entertainment | |
| Finance | |
| Health & Fitness |
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
| - (void)disableKeyboardScroll | |
| { | |
| self.webView.scrollView.scrollEnabled = NO; | |
| self.webView.scrollView.delegate = self; | |
| } | |
| - (void)scrollViewDidScroll:(UIScrollView *)scrollView | |
| { | |
| self.webView.scrollView.bounds = self.webView.bounds; | |
| } |
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 R { | |
| struct Images { | |
| static var doge: NSImage { | |
| return NSImage(contentsOfFile: "...")! | |
| } | |
| } | |
| } | |
| R.Images.doge |
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 | |
| func foo() -> AnyObject? { | |
| return NSDictionary() | |
| } | |
| func cast<A>(type: A.Type)(object: Any) -> A? { | |
| return object as? A | |
| } |
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 | |
| func foo() -> AnyObject? { | |
| return NSDictionary() | |
| } | |
| func cast<A>(type: A.Type)(object: Any) -> A? { | |
| return object as? A | |
| } |
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
| source 'https://github.com/CocoaPods/Specs.git' | |
| target :iOS do | |
| platform :ios, '7.1' | |
| link_with 'YourAppTarget', 'WidgetExtension', 'ShareExtension' | |
| # pods... | |
| end | |
| target :Mac do |
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
| class Foo { | |
| struct Keys { | |
| static let keychainGroup = "com.foo.keychain-group" | |
| static let enabled = "foo.enabled" | |
| } | |
| // now you can just write `Keys.enabled`, `Keys.keychainGroup` inside of the Foo class. | |
| } |
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
| infix operator ??= { | |
| associativity right | |
| precedence 90 | |
| assignment | |
| } | |
| func ??= <T>(inout variable: T?, expr: @autoclosure () -> T) { | |
| if variable == nil { | |
| variable = expr() | |
| } |
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 Stream { | |
| let string: NSString | |
| var position: Int | |
| var matchingRange: NSRange { | |
| return NSRange(location: position, length: string.length - position) | |
| } | |
| } |