---
title: NSSelectionAffinity
framework: appkit
role: symbol
role_heading: Enumeration
path: appkit/nsselectionaffinity
---

# NSSelectionAffinity

These constants specify the preferred direction of selection. They’re used by selectionAffinity and setSelectedRange(_:affinity:stillSelecting:).

## Declaration

```swift
enum NSSelectionAffinity
```

## Topics

### Constants

- [NSSelectionAffinity.upstream](appkit/nsselectionaffinity/upstream.md)
- [NSSelectionAffinity.downstream](appkit/nsselectionaffinity/downstream.md)

### Initializers

- [init(rawValue:)](appkit/nsselectionaffinity/init(rawvalue:).md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [RawRepresentable](swift/rawrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Constants

- [NSSelectionGranularity](appkit/nsselectiongranularity.md)
- [NSFindPanelAction](appkit/nsfindpanelaction.md)
- [Input Sources Locale Identifiers](appkit/input-sources-locale-identifiers.md)
- [Find Panel Search Metadata](appkit/find-panel-search-metadata.md)
- [NSFindPanelSubstringMatchType](appkit/nsfindpanelsubstringmatchtype.md)
