# Single-element labeled tuples?

**URL:** <https://forums.swift.org/t/single-element-labeled-tuples/9797>\
**Category:** Discussion\
**Created:** [February 11, 2018, 11:41pm UTC](https://forums.swift.org/t/single-element-labeled-tuples/9797 "2018-02-11T23:41:22Z")\
**Posts on this page:** 1\
**Showing post:** 45

<div class="post-metadata">

**Author:** ![anon9791410](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@anon9791410](https://forums.swift.org/u/anon9791410)\
**Post date:** [May 12, 2020, 1:28am UTC](https://forums.swift.org/t/single-element-labeled-tuples/9797/45 "2020-05-12T01:28:40Z")

</div>

TIL that single-element labeled tuples are in the language in at least one place: [How do you get labeled associated values from Mirror children? - #3 by Jessy](https://forums.swift.org/t/how-do-you-get-labeled-associated-values-from-mirror-children/36377/3)

I like them as placeholders for when I know something else is coming, but it's not worth making a struct for because it will only be the return type for one function. And I wish I didn't need this workaround:

```swift
public enum Tuple { }

public extension Tuple {
  /// Used to create a 2-tuple, as a single-element tuple can't have a label.
  typealias Placeholder = Void

  /// Stuff an element into a tuple that will have a labeled first element
  /// when converted to a return value.
  static func `init`<LabeledElement>(
    _ labeledElement: LabeledElement
  ) -> (LabeledElement, Placeholder) {
    ( labeledElement, Placeholder() )
  }
}

```

```swift
func makeIllustrations() -> [(image: String, Tuple.Placeholder)] {
  [ ( image: "🐻", Tuple.Placeholder() ),
    Tuple.`init`("🍯"),
    ( image: "🐝", () )
  ]
}

XCTAssertEqual(makeIllustrations()[1].image, "🍯")

```

---

_[View the full topic](https://forums.swift.org/t/single-element-labeled-tuples/9797)._
