Index

RBLocaleCenter.swift

Classes


RBLocaleCenter

Provides locality-specific serialisations and conversions - e.g. dates, numbers, currencies, etc.

Properties

The main locale center.
static public let main RBLocaleCenter { get set }

Functions

Parses a string to retrieve a number.
@param numberString : The string that contains a number.
@returns The resulting NSNumber object or nil.
public func number(from numberString: String?) -> NSNumber?

Parses a string to retrieve a number.
@param numberString : The string that contains a number.
@param numberStyle : The formatting style to expect in the string.
@returns The resulting NSNumber object or nil.
public func number(from numberString: String?, using numberStyle: NumberFormatter.Style) -> NSNumber?

Formats a number to a string.
@param number : The number to format.
@returns The resulting formatted string.
public func string(from number: NSNumber) -> String

Formats a number to a string.
@param number : The number to format.
@param numberStyle : The formatting style to use.
@returns The resulting formatted string.
public func string(from number: NSNumber, using numberStyle: NumberFormatter.Style) -> String

Parses a date from a string.
@param dateString : The string to parse.
@param universalTime : Whether the date is UTC.
@returns The parsed NSDate object.
public func date(from dateString: String, universalTime: Bool) -> Date?

Parses a date from a string.
@param dateString : The string to parse.
@param dateStyle : The formatting style to expect for the date component of the string.
@param timeStyle : The formatting style to expect for the time component of the string.
@param universalTime : Whether the date is UTC.
@returns The parsed Date object.
public func date(from dateString: String, usingDateStyle dateStyle: DateFormatter.Style, time timeStyle: DateFormatter.Style, universalTime: Bool) -> Date?

Formats an Date into a string.
@param date : The NSDate to format.
@param universalTime : Whether the date is UTC.
@returns The formatted string value.
public func string(from date: Date, universalTime: Bool) -> String

Formats an Date into a string.
@param date : The Date to format.
@param dateStyle : The formatting style to use for the date component.
@param timeStyle : The formatting style to use for the time component.
@param universalTime : Whether the date is UTC.
@returns The formatted string value.
public func string(from date: Date?, usingDateStyle dateStyle: DateFormatter.Style, time timeStyle: DateFormatter.Style, universalTime: Bool) -> String