I hereby claim:
- I am pretz on github.
- I am pretz (https://keybase.io/pretz) on keybase.
- I have a public key whose fingerprint is 9B4A E36E 43C7 87E1 EAD1 2B6A 6D83 84D4 CFE7 7658
To claim this, I am signing this object:
public func keyboardInfoFromUserInfo(userInfo: [NSObject: AnyObject]) -> (beginFrame: CGRect, endFrame: CGRect, animationCurve: UIViewAnimationOptions, animationDuration: Double)? { | |
if let beginFrameValue = userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue, | |
let endFrameValue = userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue, | |
let animationCurve = userInfo[UIKeyboardAnimationCurveUserInfoKey] as? NSNumber, | |
let animationDuration = userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSNumber { | |
return ( | |
beginFrame: beginFrameValue.CGRectValue(), | |
endFrame: endFrameValue.CGRectValue(), | |
animationCurve: UIViewAnimationOptions(rawValue: animationCurve.unsignedIntegerValue << 16), | |
animationDuration: animationDuration.doubleValue) |
let inView: UIView = { | |
switch display { | |
case .InWindow: | |
return self.view.window! | |
case .AboveKeyboard: | |
return UIApplication.sharedApplication().windows[1] as UIView | |
default: | |
return self.view | |
} | |
}() |
I hereby claim:
To claim this, I am signing this object:
BasedOnStyle: Chromium | |
IndentWidth: 4 | |
UseTab: Never | |
ColumnLimit: 150 | |
ObjCSpaceAfterProperty: true | |
PointerBindsToType: false | |
AllowShortIfStatementsOnASingleLine: false | |
IndentCaseLabels: true | |
SpacesInContainerLiterals: false | |
AllowShortFunctionsOnASingleLine: false |
import Foundation | |
class MyDictionary : NSDictionary { | |
convenience init(beAwesome:Bool) { | |
if (beAwesome) { | |
self.init(object: true, forKey:"awesome") | |
} else { | |
self.init(object: false, forKey:"awesome") | |
} | |
} |
struct MockFile<T> { | |
let fileName: String | |
init(_ fileName: String) { | |
self.fileName = fileName | |
} | |
} | |
struct Mocks { | |
static let UserWithProfile = MockFile<User>("registrations_mock") |
import Foundation | |
class Something: NSObject { | |
func fun(string: String) { | |
println(string) | |
} | |
// error: method 'fun' redeclares Objective-C method 'fun:' | |
func fun(int: Int) { |
// Playground - noun: a place where people can play | |
import UIKit | |
class LumaJSONObject: Printable { | |
var value: AnyObject? | |
subscript(index: Int) -> LumaJSONObject? { | |
return (value as? [AnyObject]).map { LumaJSONObject($0[index]) } | |
} |
import UIKit | |
func allOptions<T: RawOptionSetType where T.RawValue == UInt>(optionSet: T) -> [T] { | |
var options = [T]() | |
var mask: UInt = 1 | |
while mask != 0 { | |
if let newOption = T(rawValue: mask) where (optionSet & newOption) == newOption { | |
options.append(newOption) | |
} | |
mask <<= 1 |
import Foundation | |
public func SelectTypedItemFromArray<T>(array: [AnyObject]) -> T? { | |
for eachItem in array { | |
if let typedItem = eachItem as? T { | |
return typedItem | |
} | |
} | |
return nil | |
} |