Contents

set(_:forKey:)

Sets the value of the specified key to an integer.

Declaration

func set(_ value: Int, forKey defaultName: String)

Parameters

  • value:

    The integer value to store in the defaults database.

  • defaultName:

    The key that contains the setting’s name.

Discussion

This method places the integer value in an NSNumber type before writing the key and value to the defaults database. After you call this method, the system generates a didChangeNotification for registered observers.

See Also

Setting the value for a key