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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
class MyViewController : UIViewController { | |
lazy var view1: UIView = { | |
let view = UIView() | |
view.backgroundColor = .red | |
return view |
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 Foundation | |
import PlaygroundSupport | |
PlaygroundPage.current.needsIndefiniteExecution = true | |
/* Transactions - Why? | |
- Influenced by databases (all of the operations succeed or fail together) | |
- Implement undo functionality | |
- Multithreaded |
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 <CoreImage/CoreImage.h> | |
@interface RedFilter : CIFilter | |
@property (strong, nonatomic) CIImage *inputImage; | |
@end | |
@implementation RedFilter | |
- (CIColorKernel *)myKernel { | |
static CIColorKernel *kernel = nil; | |
static dispatch_once_t once; |
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
# Requires having a property on the view controller called "activeField" which | |
# will be centered inside remaining space. | |
- (void)keyboardWasShown:(NSNotification*)aNotification { | |
NSDictionary* info = [aNotification userInfo]; | |
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size; | |
CGFloat kbDuration = [[info objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue]; | |
UIViewAnimationOptions kbAnimationCurve = [[info objectForKey:UIKeyboardAnimationCurveUserInfoKey] integerValue]; | |
CGRect aRect = self.view.frame; |