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 var sharedInstance : PusherManager { | |
| struct Static { | |
| static let instance : PusherManager = PusherManager() | |
| } | |
| return Static.instance; | |
| } |
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 func countryNames() -> [String] { | |
| struct Static { | |
| static var instance: [String]? | |
| } | |
| if let names = Static.instance { | |
| return names | |
| } | |
| var names = [String]() | |
| for code in NSLocale.ISOCountryCodes() as [String] { |
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
| -fno-objc-arc | |
| Add -fobjc-arc to compiler flags under build phases to ARC files to make them compile correctly for non-ARC projects. |
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
| //viewDidload | |
| if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) { | |
| [self prefersStatusBarHidden]; | |
| [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; | |
| } else { | |
| [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; | |
| } | |
| // Add this Method |
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
| + (id)objectForKey:(NSString *)key | |
| { | |
| if ([key length] == 0) { | |
| return nil; | |
| } | |
| NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:key]; | |
| if (!data) { | |
| 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
| // Indicate != nil instead of bool | |
| if navigationController { | |
| } | |
| if navigationController != nil { | |
| } | |
| // Use require keywork for require methods |
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
| NSArray* array = [UIApplication sharedApplication].windows; | |
| for(id windowObject in array){ | |
| NSString* class = NSStringFromClass([windowObject class]); | |
| if([class isEqualToString:@"UITextEffectsWindow"]){ | |
| UIWindow* keyboardWindow = (UIWindow*)windowObject; | |
| keyboardWindow.windowLevel = self.view.window.windowLevel+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
| class LINJSONHelper { | |
| class func jsonStringWithObject(obj: AnyObject) -> String? { | |
| var error: NSError? | |
| let jsonData = NSJSONSerialization.dataWithJSONObject(obj, options: NSJSONWritingOptions(0), error: &error) | |
| if error != nil { | |
| println("Error creating JSON data: \(error!.description)"); | |
| return nil | |
| } | |
| return NSString(data: jsonData, 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
| private func addListBubbleCellsWithCount(count: Int) { | |
| var contentOffset = self.tableView.contentOffset | |
| UIView.setAnimationsEnabled(false) | |
| var indexPaths = [NSIndexPath]() | |
| var heightForNewRows: CGFloat = 0 | |
| for var i = 0; i < count; i++ { | |
| let indexPath = NSIndexPath(forRow: i, inSection: 0) |
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 handleKeyboardWillShowNotification(notification: NSNotification) { | |
| if self.inputContainerViewBottomLayoutGuideConstraint.constant == 0 { | |
| keyboardWillChangeFrameWithNotification(notification, showKeyboard: true) | |
| scrollBubbleTableViewToBottomAnimated(true) | |
| } | |
| } | |
| func handleKeyboardWillHideNotification(notification: NSNotification) { | |
| if self.inputContainerViewBottomLayoutGuideConstraint.constant > 0 { | |
| keyboardWillChangeFrameWithNotification(notification, showKeyboard: false) |