What the Snippet

I am really getting used to this video blogging business. It feels like I want to make all future posts videos. So easy, so convenient…

This one is about using Xcode snippets to speed up your development. I present a use case with cocos2d-x, but it can be used with anything really… Even Swift ;).

Youtube link

Here are the snippets. Just drag the code over to the snippets area in Xcode:

class <#class#> : public <#superclass#>
{

public:

    static <#class#> *create(<#args-definition#>);
    virtual bool init(<#args-definition#>);

};
<#class#> *<#class#>::create(<#args-definition#>)
{
    <#class#> *obj = new <#class#>();
    obj->init(<#args#>);
    obj->autorelease();

    return obj;
}

bool <#class#>::init(<#args-definition#>)
{
    if (!<#superclass#>::init(<#superargs#>))
    {
        return false;
    }

    return true;
}