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 *getStatusBar() { | |
| UIView *subViewWindow = [[UIApplication sharedApplication] valueForKey:@"statusBarWindow"]; | |
| for (UIView *i in subViewWindow.subviews) { | |
| if ([i isKindOfClass:NSClassFromString(@"UIStatusBar")]) { | |
| return i; | |
| } | |
| } | |
| 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
| import UIKit | |
| /** | |
| You can use this to initalize an object (class or struct) while containing the set up code for it in a block | |
| */ | |
| @warn_unused_result | |
| func setUpObject<T>(obj: T, withBlock setUp: (inout T) -> ()) -> T { | |
| var _obj = obj | |
| setUp(&_obj) | |
| return _obj |
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 | |
| class ClickableLinkTextView: UITextView { | |
| override init(frame: CGRect, textContainer: NSTextContainer?) { | |
| super.init(frame: frame, textContainer: textContainer) | |
| setUp() | |
| } | |
| required init?(coder aDecoder: NSCoder) { |
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 UIStoryboard { | |
| func instantiateViewControllerWithTypeAsIdentifier<T>(t: T.Type) -> T { | |
| return instantiateViewControllerWithIdentifier(String(t)) as! 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
| import AVFoundation | |
| class EACAudioManager: NSObject { | |
| static let sharedInstance = EACAudioManager() | |
| var volumeDidChange = { (newVolume: Float) -> () in } | |
| var currentVolume: Float { return AVAudioSession.sharedInstance().outputVolume } | |
| override init() { | |
| super.init() | |
| try! AVAudioSession.sharedInstance().setActive(true) | |
| AVAudioSession.sharedInstance().addObserver(self, forKeyPath: "outputVolume", options: NSKeyValueObservingOptions.New, context: nil) |
NewerOlder