---
title: "CFPreferencesSetMultiple(_:_:_:_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfpreferencessetmultiple(_:_:_:_:_:)"
---

# CFPreferencesSetMultiple(_:_:_:_:_:)

Convenience function that allows you to set and remove multiple preference values.

## Declaration

```swift
func CFPreferencesSetMultiple(_ keysToSet: CFDictionary?, _ keysToRemove: CFArray?, _ applicationID: CFString, _ userName: CFString, _ hostName: CFString)
```

## Parameters

- `keysToSet`: A dictionary containing the key/value pairs for the preferences to set.
- `keysToRemove`: An array containing a list of keys to remove.
- `applicationID`: The ID of the application whose preferences you wish to modify. Takes the form of a Java package name, com.foosoft.
- `userName`: doc://com.apple.corefoundation/documentation/CoreFoundation/kCFPreferencesCurrentUser to modify the current user’s preferences, otherwise doc://com.apple.corefoundation/documentation/CoreFoundation/kCFPreferencesAnyUser to modify the preferences of all users.
- `hostName`: doc://com.apple.corefoundation/documentation/CoreFoundation/kCFPreferencesCurrentHost to modify the preferences of the current host, otherwise doc://com.apple.corefoundation/documentation/CoreFoundation/kCFPreferencesAnyHost to modify the preferences of all hosts.

## Discussion

Discussion Behavior is undefined if a key is in both keysToSet and keysToRemove

## See Also

### Setting Preference Values

- [CFPreferencesSetAppValue(_:_:_:)](corefoundation/cfpreferencessetappvalue(_:_:_:).md)
- [CFPreferencesSetValue(_:_:_:_:_:)](corefoundation/cfpreferencessetvalue(_:_:_:_:_:).md)
