Objective-C Examples
Objective-C aligned plain-text table renderer
Computes column widths and renders headers and rows as a padded, pipe-separated plain-text table string.
Objective-C Base64 encode and decode with validation
Encodes UTF-8 strings to Base64 and decodes them back with explicit NSError messages for malformed input.
Objective-C form field validation with error map
Checks name, email, and age fields, returning a dictionary of field-specific validation messages instead of throwing.
Objective-C JSON decoding with actionable errors
Decodes NSData as JSON and wraps parse offsets and type mismatches in descriptive NSError messages.
Objective-C query string builder and parser
Percent-encodes dictionaries into query strings and parses them back, skipping empty keys and decoding escapes.
Objective-C bounded worker pool with ordered results
Runs work blocks on a fixed number of NSOperationQueue workers while keeping results and errors index-aligned.
Objective-C sync HTTP GET JSON with timeout
Performs a synchronous HTTP GET with a deadline, then decodes the response body as JSON or reports the failure.
Objective-C environment config loader with validation
Reads PORT, APP_ENV, and DEBUG from the process environment, applies defaults, and returns typed errors.
Objective-C bounded LRU cache with timestamp recency
A mutable dictionary cache that evicts the least recently used entry once its count exceeds a fixed limit.
Objective-C token bucket rate limiter in plain C
A C struct and two functions that refill tokens over time and reject calls faster than the configured rate.
Objective-C stable multi-key sort with nulls last
Sorts Objective-C dictionaries by name, then age, placing nil values last and preserving input order for ties.
Objective-C chunk an array into fixed-size batches
Splits an ordered Foundation array into consecutive subarrays of a fixed size, with the final batch keeping the remainder.
Objective-C stream file lines with NSInputStream
Reads a UTF-8 text file in 4 KB chunks through NSInputStream and hands each line to a block as it arrives.
Objective-C deep clone and recursive dictionary merge
Deep-copies dictionaries and arrays, then merges an overlay onto a base document without mutating either input.
Objective-C retry helper with capped exponential backoff
Runs a Foundation block with capped exponential backoff and jitter until it succeeds, then reports the final error.