Error "Cannot invoke initializer for type 'String' with an argument list of type '(Int64?)'" with nil-coalescing operator

Dan*_*wer -4 int64 swift

I am getting an error "Cannot invoke initializer for type 'String' with an argument list of type '(Int64?)'" with nil-coalescing operator.

There are similar questions on stackoverflow, but they did not give me the solution I need.

My code with errors in comments:

let cell = tableView.dequeueReusableCell(withIdentifier: "countCell", for: indexPath)
cell.textLabel?.text = String(detailItem?.count) ?? "1" // Cannot invoke initializer for type 'String' with an argument list of type '(Int64?)'

let cell = tableView.dequeueReusableCell(withIdentifier: "countCell", for: indexPath)
cell.textLabel?.text = String(Int(detailItem?.count)) ?? "1" // Cannot invoke initializer for type 'Int' with an argument list of type '(Int64?)'

let cell = tableView.dequeueReusableCell(withIdentifier: "countCell", for: indexPath)
cell.textLabel?.text = String(Int(detailItem!.count)) ?? "1" // Cannot invoke initializer for type 'Int' with an argument list of type '(Int64?)'

let cell = tableView.dequeueReusableCell(withIdentifier: "countCell", for: indexPath)
cell.textLabel?.text = String(detailItem?.count ?? "1") // Cannot convert value of type 'String' to expected argument type 'Int64'
Run Code Online (Sandbox Code Playgroud)

Div*_*iya 5

在此处输入图片说明

let tmp = Int64(10)
print(String(tmp))
Run Code Online (Sandbox Code Playgroud)