(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
self.view.layer.anchorPoint = CGPointMake(0.50, 1.0); | |
CAKeyframeAnimation *bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; | |
bounceAnimation.values = [NSArray arrayWithObjects: | |
[NSNumber numberWithFloat:0.05], | |
[NSNumber numberWithFloat:1.08], | |
[NSNumber numberWithFloat:0.92], | |
[NSNumber numberWithFloat:1.0], | |
nil]; |
#import <UIKit/UIKit.h> | |
@interface UIView (SMFrameAdditions) | |
@property (nonatomic, assign) CGPoint $origin; | |
@property (nonatomic, assign) CGSize $size; | |
@property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties | |
@property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect | |
@end |
#import <Foundation/Foundation.h> | |
@interface NSObject (NSDictionaryRepresentation) | |
/** | |
Returns an NSDictionary containing the properties of an object that are not nil. | |
*/ | |
- (NSDictionary *)dictionaryRepresentation; | |
@end |
#pragma mark - Embed Video | |
- (UIWebView *)embedVideoYoutubeWithURL:(NSString *)urlString andFrame:(CGRect)frame { | |
NSString *videoID = [self extractYoutubeVideoID:urlString]; | |
NSString *embedHTML = @"\ | |
<html><head>\ | |
<style type=\"text/css\">\ | |
body {\ | |
background-color: transparent;\ |
- (id)init | |
{ | |
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainInterface" bundle:nil]; | |
self = [storyboard instantiateViewControllerWithIdentifier:@"MyControllerIdentifier"]; | |
// Set up ivars here. 'self' won't be nil; if it is, you passed an invalid identifier | |
// and UIKit would have thrown an exception anyway. | |
return self; | |
} |
#import <Foundation/Foundation.h> | |
@interface MySingleton : NSObject | |
+(instancetype) sharedInstance; | |
// clue for improper use (produces compile time error) | |
+(instancetype) alloc __attribute__((unavailable("alloc not available, call sharedInstance instead"))); | |
-(instancetype) init __attribute__((unavailable("init not available, call sharedInstance instead"))); | |
+(instancetype) new __attribute__((unavailable("new not available, call sharedInstance instead"))); |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// | |
// CollectionViewDataSource.swift | |
// Khan Academy | |
// | |
// Created by Andy Matuschak on 10/14/14. | |
// Copyright (c) 2014 Khan Academy. All rights reserved. | |
// | |
import UIKit |
##Generate and Install IPA's file in device through Command Line
###Thanks to Mattt and phonegap's scripts
Take a note: all this steps can be automatized in a single script, if you know how to write it. (Bash or Ruby will be fine)
1.- Install your Provisioning Profile and Developer Certificate
2.- Install Shenzhen and ios-deploy: the firstone will generate the IPA file and the secondone will install it onto your device
protocol OptionalType { | |
typealias T | |
var optional: T? { get } | |
} | |
extension Optional : OptionalType { | |
var optional: T? { return self } | |
} | |
extension SequenceType where Generator.Element: OptionalType { |