---
description: 這看起來是一個問題，但卻產生兩個錯誤，很奇怪。
---

# Argument type 'xxx' does not conform to expected type '\_FormatSpecifiable'

另一個錯誤訊息：

```
❌ Cannot convert value of type 'MyClass' to expected argument type 'String'
```

{% tabs %}
{% tab title="❌ Errors" %}
```swift
import SwiftUI

struct MyStruct: CustomStringConvertible {
    var description: String { "hello" }
}

class MyClass: CustomStringConvertible {
    var description: String { "hi" }
}


let a = MyStruct()
let b = MyClass()
print("\(a)")        // hello
print("\(b)")        // hi

// ❌ Argument type 'MyStruct' does not conform to
//    expected type '_FormatSpecifiable'
let text1 = Text("\(a)")

// ❌ Cannot convert value of type 'MyClass' to
//    expected argument type 'String'
let text2 = Text("\(b)")
```
{% endtab %}

{% tab title="📘 參考" %}
* StackOverflow：[Argument type 'xxx' does not conform to expected type '\_FormatSpecifiable'](https://stackoverflow.com/questions/64765624/argument-type-xxx-does-not-conform-to-expected-type-formatspecifiable)  ⭐
{% endtab %}

{% tab title="👥 相關" %}
* [SwiftUI](https://developer.apple.com/documentation/swiftui) > [Views and Controls](https://developer.apple.com/documentation/swiftui/views-and-controls) > [LocalizedStringKey](https://developer.apple.com/documentation/swiftui/localizedstringkey)
* Swift > Standard Library > [Basic Behaviors](https://developer.apple.com/documentation/swift/swift_standard_library/basic_behaviors) > [CustomStringConvertible](https://developer.apple.com/documentation/swift/customstringconvertible)
* [🔰 String Interpolation](../swift/type/category/basic/string/string-interpolation)
{% endtab %}
{% endtabs %}
