Instance Method

setValue(_:for:)

Set the value of one of the properties, using an enumeration value instead of a property name.

Declaration

mutating func setValue(_ value: Int?, for component: Calendar.Component)

Discussion

The calendar and timeZone and isLeapMonth properties cannot be set by this method.

See Also

Accessing Calendar Components

func value(for: Calendar.Component) -> Int?

Returns the value of one of the properties, using an enumeration value instead of a property name.

enum Calendar.Component

An enumeration for the various components of a calendar date.