---
title: "actionForSegment(at:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uisegmentedcontrol/actionforsegment(at:)"
---

# actionForSegment(at:)

Fetches the action of the segment at the index you specify, if one exists.

## Declaration

```swift
func actionForSegment(at segment: Int) -> UIAction?
```

## Parameters

- `segment`: An integer value index of a segment.

## Return Value

Return Value The UIAction for the segment at the index you specify, or nil if the segment doesn’t have an action assigned.

## See Also

### Managing segment actions

- [setAction(_:forSegmentAt:)](uikit/uisegmentedcontrol/setaction(_:forsegmentat:).md)
