layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories:
- Testing
- iOS
- Patterns
- Xcode
UIView * view = [[UIView alloc] initWithFrame:CGRectMake( 0.0f, 0.0f, kAffirmationThumbnailWidth, kAffirmationThumbnailHeight )]; | |
view.backgroundColor = [UIColor grayColor]; | |
UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, kAffirmationThumbnailWidth, kAffirmationThumbnailHeight)]; | |
imageView.backgroundColor = [UIColor clearColor]; | |
imageView.alpha = 1.0; | |
[view addSubview:imageView]; | |
// Background getting of small image and loading into memory | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){ | |
NSString * imagePathSmall = [NSString stringWithFormat:@"%@_small.jpg",[[affirmation imagePath] stringByDeletingPathExtension]]; |
extern void bilContext_glClientState(dispatch_block_t contextBlock, GLenum clientState, ... ) | |
{ | |
va_list arguments; | |
GLenum value; | |
va_start(arguments, clientState); | |
for (value = clientState; value > 0; value = va_arg(arguments, GLenum)) | |
{ | |
glEnableClientState(value); | |
} |
#define ENUMERATE_NULL_TERMINATED_VARARGS(firstArgument, type, argumentName, operation) \ | |
{ \ | |
va_list arguments; \ | |
va_start(arguments, firstArgument); \ | |
type argumentName = firstArgument; \ | |
while (argumentName) \ | |
{ \ | |
{ \ | |
operation \ | |
} \ |
/** | |
An inline (read: no overhead) function that will perform the physics increment for a given particle | |
@return A boolean for whether the particle has expired and needs to be removed | |
*/ | |
extern inline BOOL updateParticle(BILParticleAtomConventional * atom, BILParticleModel * model, NSTimeInterval deltaTime) | |
{ | |
// Time to Live | |
atom->atom.timeToLive -= deltaTime; | |
#define recursiveBlock(type_out__, name__, type_in__, block__) \ | |
typedef type_out__ (^type_in_out__##name__)type_in__;\ | |
__weak __block type_in_out__##name__ name__;\ | |
type_in_out__##name__ temp__##name__;\ | |
name__ = temp__##name__ = ^type_out__(type_in__) block__ |
Pod::Spec.new do |s| | |
s.name = "ReactiveCocoa" | |
s.version = "2.0.0-RC3" | |
s.summary = "A framework for composing and transforming sequences of values." | |
s.homepage = "https://github.com/blog/1107-reactivecocoa-is-now-open-source" | |
s.author = { "Josh Abernathy" => "[email protected]" } | |
s.source = { :git => "https://github.com/ReactiveCocoa/ReactiveCocoa.git", :tag => 'v2.0-RC3' } | |
s.license = 'Simplified BSD License' | |
s.description = "ReactiveCocoa offers:\n" \ | |
"1. The ability to compose operations on future data.\n" \ |
[ | |
{"name" : "grumpy", "image_url" : "http://i.imgur.com/llerBCQ.jpg"}, | |
{"name" : "long", "image_url" : "http://i.imgur.com/SkSNqfB.jpg"}, | |
{"name" : "bullet", "image_url" : "http://i.imgur.com/djCifni.jpg"}, | |
{"name" : "ceiling", "image_url" : "http://i.imgur.com/W86UhUT.png"} | |
] |
layout: post title: "ReactiveCocoa Unit Testing Tips" date: 2013-09-22 20:45 comments: true categories:
// Playground - noun: a place where people can play | |
import Cocoa | |
let str = "Foo Bar bannana' basa fist ada-2@🚅 afa2-ff 👍🎭-asd👍 adsa😃da\ndas🎉d" | |
let whitespaceSet = NSCharacterSet.whitespaceAndNewlineCharacterSet() | |
enum ScanResult<T> { | |
case Append(T) |
static func decodeImperative<X: XMLParsableType>(xml: X) -> Result<Animal> { | |
if let type = XMLParser.parseChildText("type")(xml: xml).toOptional() { | |
if let name = XMLParser.parseChildText("name")(xml: xml).toOptional() { | |
if let urlString = XMLParser.parseChildText("url")(xml: xml).toOptional() { | |
return Result.value(self(type: type, name: name, url: NSURL.URLWithString(urlString)) ) | |
} | |
return Result.Error(decodeError("Could not parse 'urlString' as a String")) | |
} | |
return Result.Error(decodeError("Could not parse 'name' as a String")) | |
} |