Declared in NSString+Helpers.h

Tasks

Properties

urlScheme

@property (readonly) NSString *urlScheme
Discussion

If the string is URL-like, will return a string containing the URL scheme and trailing ://

Declared In

NSString+Helpers.h

Class Methods

stringWithFormat:array:

+ (instancetype)stringWithFormat:(NSString *)format array:(NSArray *)arguments
Discussion

An alias to [NSString stringWithFormat:] that uses an array of arguments rather than a varargs list.

Parameters

format

A C-style format string.

arguments

An array of arguments corresponding to the placeholders in format.

Return Value

An instantiated NSString with a value created from evaluating [NSString stringWithFormat:] with the given format and arguments.

Declared In

NSString+Helpers.h

Instance Methods

stringByEvaluatingTemplateWithData:

- (NSString *)stringByEvaluatingTemplateWithData:(NSDictionary *)data
Discussion

Evaluates a {handlebar-style} template string for some given template data.

For example, calling this on the string @"Hi, {name}!" with the dictionary @{@"name":@"Mom"} will return @"Hi, Mom!".

Parameters

data

A dictionary mapping template variable names to replacement values

Return Value

A copy of the current string, with all instances of variable names wrapped in curly braces replaced with the appropriate data from the dictionary.

Declared In

NSString+Helpers.h

stringWithTemplatedQueryParams:data:

- (NSString *)stringWithTemplatedQueryParams:(NSDictionary *)params data:(NSDictionary *)data
Discussion

Creates a query param string from a templated dictionary, and appends it onto the given string.

Parameters

params

A dictionary mapping from a param’s user-readable name to the actual templated parameter code to use

data

A dictionary mapping template variable names to replacement values

Return Value

A copy of the current string with a well-formed query params string appended at the end, with all instances of variable names wrapped in curly braces replaced with the appropriate data.

Declared In

NSString+Helpers.h