Variable |
Type |
This file contains 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
// TPSpringyModalTransition.h | |
// iPeru | |
// | |
// Created by Pietro Rea on 5/4/14. | |
// Copyright (c) 2014 Pietro Rea. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface TPSpringyModalTransition : NSObject <UIViewControllerAnimatedTransitioning> |
This file contains 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 CoreData | |
class CoreDataManager { | |
var context:NSManagedObjectContext | |
var psc:NSPersistentStoreCoordinator | |
var model:NSManagedObjectModel | |
var store:NSPersistentStore? | |
init() { |
This file contains 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
//From https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html | |
- (NSDate *)dateFromRFC3339String:(NSString *)dateString { | |
static NSDateFormatter *sRFC3339DateFormatter = nil; | |
if (sRFC3339DateFormatter == nil) { | |
sRFC3339DateFormatter = [[NSDateFormatter alloc] init]; | |
NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; | |
[sRFC3339DateFormatter setLocale:enUSPOSIXLocale]; |
This file contains 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
//In UIViewController subclass | |
@interface UIWindow (AutoLayoutDebug) | |
+ (UIWindow *)keyWindow; | |
- (NSString *)_autolayoutTrace; | |
@end | |
- (void)didRotateFromInterfaceOrientation: (UIInterfaceOrientation)fromInterfaceOrientation | |
{ | |
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; |
This file contains 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
//Add to Project-Prefix.pch | |
#ifdef DEBUG | |
#define debugLog(...) NSLog(__VA_ARGS__) | |
#else | |
#define debugLog(...) // Nothing | |
#endif |
This file contains 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
NSString *html = @"<bold>Wow!</bold> Now <em>iOS</em> can create <h3>NSAttributedString</h3> from HTMLs!"; | |
NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType}; | |
NSAttributedString *attrString = [[NSAttributedString alloc] initWithData:[html dataUsingEncoding:NSUTF8StringEncoding] options:options documentAttributes:nil error:nil]; |
This file contains 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 dataTask = urlSession.dataTaskWithURL(url!, completionHandler: { [unowned self] (data: NSData!, response: NSURLResponse!, error: NSError!) -> Void in | |
//add code here | |
}) |
This file contains 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
var block : @objc_block (NSString!) -> Void = { | |
[unowned self] (string : NSString!) -> Void in | |
let jsText = "\(string)\n" | |
self.outputTextView.setText(jsText, concatenate: true) | |
} | |
context.setObject(unsafeBitCast(block, AnyObject.self), | |
forKeyedSubscript: "print") |
This file contains 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 | |
extension UIViewController { | |
func addChildVC(viewController: UIViewController) { | |
addChildViewController(viewController) | |
view.addSubview(viewController.view) | |
viewController.didMoveToParentViewController(self) | |
} | |
} |
OlderNewer