Skip to content

Instantly share code, notes, and snippets.

#import "UINavigationController+RACSignalSupport.h"
#import <ReactiveCocoa/ReactiveCocoa.h>
#import <ReactiveCocoa/RACDelegateProxy.h>
#import <ReactiveCocoa/NSObject+RACDescription.h>
#import <objc/runtime.h>
@implementation UIImagePickerController (RACSignalSupport)
-(BOOL)testItem:( id )item_
withError:( NSError** )error_
{
if ([item_ isEqual: @(3)])
{
*error_ = [[NSError alloc] initWithDomain: @"MyErrorDomain" code: 1 userInfo: nil];
return NO;
}
return YES;
}
countElements("🇬🇧🇬🇧🇬🇧🇬🇧🇬🇧🇬🇧🇬🇧🇬🇧🇬🇧🇮🇹🇯🇵") == 1
<html>
<head>
<meta property="al:ios:url" content="shout://" />
<meta property="al:ios:app_store_id" content="951847606" />
<meta property="al:ios:app_name" content="Shout" />
<meta property="og:title" content="Shout" />
<meta property="og:type" content="website" />
</head>
</html>
protocol AbbreviatedNumber {
var doubleValue: Double { get }
}
extension Int: AbbreviatedNumber {
var doubleValue: Double {
return Double(self)
}
}
import UIKit
extension UIColor {
convenience init(rgbaValue: UInt32) {
let red = CGFloat((rgbaValue >> 24) & 0xff) / 255.0
let green = CGFloat((rgbaValue >> 16) & 0xff) / 255.0
let blue = CGFloat((rgbaValue >> 8) & 0xff) / 255.0
let alpha = CGFloat((rgbaValue ) & 0xff) / 255.0
self.init(red: red, green: green, blue: blue, alpha: alpha)
import Foundation
enum {{enumName}} {
{% for string in strings %}
case {{string.key|swift_Identifier}}{% if string.params %}({{string.params.types|join}}){% endif %}
{% endfor %}
}
extension {{enumName}} : CustomStringConvertible {
var description : String { return self.string }
import UIKit
protocol ReusableView: class {
static var viewIdentifier: String { get }
}
extension ReusableView {
static var viewIdentifier: String {
return String(Self)
}
enum Choice {
case A
case B
case C
}
func printChoice(choice: Choice, flag: Bool) {
switch choice {
case .A, .B, .C where flag:
print("true")
@Igor-Palaguta
Igor-Palaguta / unpredictable.swift
Created November 17, 2015 22:26
Override does not override
protocol CDelegate: class {
func f()
}
class C {
weak var delegate: CDelegate?
func g() {
self.delegate?.f()
}