Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove string format property, replace with setFormat: method #11

Open
dataxpress opened this issue Nov 6, 2013 · 0 comments
Open

Remove string format property, replace with setFormat: method #11

dataxpress opened this issue Nov 6, 2013 · 0 comments
Milestone

Comments

@dataxpress
Copy link
Owner

Instead of having a separate NSString* format, only expose the formatBlock property, and make a setFormat: method that sets up the right format block only at set time instead of on every iteration.

This will ultimately improve performance, as a single block call each time is much faster than regular expression searches every frame.

So, it would look something like:

-(void)setFormat:(NSString*)format
{
    self.formatBlock = ^(NSString*) ^(float val) {
        return [NSString stringWithFormat:format,val];   
    };
}

Note - something will have to deal with formats that pass in %d or %i (as the current regex does) - perhaps find these and then cast to int if it has those? maybe two different blocks? just ideas

@dataxpress dataxpress modified the milestones: v1.2, v1.1 Mar 26, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant