Objective-C Examples

Objective-COct 23, 2026

Objective-C aligned plain-text table renderer

Computes column widths and renders headers and rows as a padded, pipe-separated plain-text table string.

formattingtableterminalcli
000
Objective-COct 23, 2026

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.

decodingencodingbase64
000
Objective-COct 23, 2026

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.

errorsvalidationforms
000
Objective-COct 23, 2026

Objective-C JSON decoding with actionable errors

Decodes NSData as JSON and wraps parse offsets and type mismatches in descriptive NSError messages.

error-handlingparsingjson
000
Objective-COct 23, 2026

Objective-C query string builder and parser

Percent-encodes dictionaries into query strings and parses them back, skipping empty keys and decoding escapes.

query-stringurlparsingpercent-encoding
000
Objective-COct 23, 2026

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.

concurrencyworker-pooloperationqueue
000
Objective-COct 23, 2026

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.

urlsessionhttpjsontimeout
000
Objective-COct 23, 2026

Objective-C environment config loader with validation

Reads PORT, APP_ENV, and DEBUG from the process environment, applies defaults, and returns typed errors.

environmentconfigurationvalidation
000
Objective-COct 23, 2026

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.

evictionlrudictionarycache
000
Objective-COct 23, 2026

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.

token-bucketthrottlingrate-limiting
000
Objective-COct 23, 2026

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.

sortingstabilitynilscomparator
000
Objective-COct 23, 2026

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.

batchingchunkingarrays
000
Objective-COct 23, 2026

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.

streamingnsinputstreamlinesfile-io
000
Objective-COct 23, 2026

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.

mergedeep-copycollectionsjson
000
Objective-COct 23, 2026

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.

foundationbackoffretryjitter
000