Instance Method

getObjectValue(_:for:range:)

Returns by reference a date representation of a given string and the range of the string used, and returns a Boolean value that indicates whether the string could be parsed.

Declaration

func getObjectValue(_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, for string: String, range rangep: UnsafeMutablePointer<NSRange>?) throws

Parameters

obj

If the receiver is able to parse string, upon return contains a date representation of string.

string

The string to parse.

rangep

If the receiver is able to parse string, upon return contains the range of string used to create the date.

error

If the receiver is unable to create a date by parsing string, upon return contains an NSError object that describes the problem.

Return Value

true if the receiver can create a date by parsing string, otherwise false.

Discussion

See Also

Converting Objects

func date(from: String) -> Date?

Returns a date representation of a given string interpreted using the receiver’s current settings.

func string(from: Date) -> String

Returns a string representation of a given date formatted using the receiver’s current settings.

class func localizedString(from: Date, dateStyle: DateFormatter.Style, timeStyle: DateFormatter.Style) -> String

Returns a string representation of a given date, formatted for the current locale using the specified date and time styles.