# OrderedDictionary: insert object at the beginning?

**URL:** <https://forums.swift.org/t/ordereddictionary-insert-object-at-the-beginning/86263>\
**Category:** Collections\
**Created:** [April 26, 2026, 6:56pm UTC](https://forums.swift.org/t/ordereddictionary-insert-object-at-the-beginning/86263 "2026-04-26T18:56:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/kelin/32/21678_2.png) [@kelin](https://forums.swift.org/u/kelin)\
**Post date:** [April 26, 2026, 6:56pm UTC](https://forums.swift.org/t/ordereddictionary-insert-object-at-the-beginning/86263/1 "2026-04-26T18:56:22Z")

</div>

Is there a way to insert object at the beginning to the OrderedDictionary, other than:

```swift
// We want to inser asset at the position 0:
orderedDict.reverse()
orderedDict[identifier] = asset
orderedDict.reverse()

```

I could put this question broader: is it possible to insert at the specific index?

---

<div class="post-metadata">

**Author:** ![x-sheep](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/x-sheep/32/40748_2.png) [@x-sheep](https://forums.swift.org/u/x-sheep)\
**Post date:** [April 26, 2026, 8:42pm UTC](https://forums.swift.org/t/ordereddictionary-insert-object-at-the-beginning/86263/2 "2026-04-26T20:42:07Z")

</div>

The function `updateValue` has an index parameter.

```swift
orderedDict.updateValue(asset, forKey: identifier, insertingAt: newIndex)

```
