Skip to content

Instantly share code, notes, and snippets.

View groue's full-sized avatar

Gwendal Roué groue

View GitHub Profile
// helper function for silentValueForKey
id silentValueForUndefinedKey(id self, SEL _cmd, NSString *key) {
return nil;
}
// The purpose of this function is to have the same result as
// [object valueForKey:key], but instead of letting [NSObject valueForUndefinedKey:]
// raise an NSUndefinedKeyException, it silently returns nil instead.
id silentValueForKey(id object, NSString *key) {
// Does object provide the same implementations of valueForKey: and valueForUndefinedKey: as NSObject?
layout.mustache:
<html>
<head><title>{{{$yield title}}}</title></head>
<body>
{{>navigation}}
<div class="content">
{{{$yield}}}
</div>
{{>footer}}
</body>
super.mustache:
<html>
<head><title>{{{title}}}</title></head>
<body>
{{>navigation}}
<div class="content">
{{{content}}}
</div>
{{>footer}}
</body>
@groue
groue / Document.mustache
Created September 22, 2012 11:03
GRMustache: variable tag that expand into a template string
{{#movie}}
{{link}}
{{#director}}
by {{link}}
{{/director}}
{{/movie}}
@groue
groue / _documentation.md
Created September 22, 2012 11:04
GRMustache: variable tag that renders a dynamic partial
@groue
groue / Document.mustache
Created September 22, 2012 11:07
GRMustache: objects that render themselves
{{movie}}
@groue
groue / _documentation.md
Created September 23, 2012 12:21
GRMustache: reuse common layout templates
@groue
groue / Document.mustache
Created September 27, 2012 07:55
GRMustache: use dynamic partials to render a collection of objects
{{movies}} {{! one movie is not enough }}
@groue
groue / _documentation.md
Created September 29, 2012 11:05
GRMustache: variadic filters
@groue
groue / gist:5610588
Last active December 17, 2015 12:29

Hello,

I'm working on a class that synthesizes its own property accessors when the user subclasses it, and declares properties @dynamic.

That class is part of the GRMustache library, and is documented in https://github.com/groue/GRMustache/blob/master/Guides/view_model.md

Today, the current implementation works, and is robust. The end user has a very simple API - he just has to declare dynamic properties in order to be granted with the features he needs. I'm quite happy of that.