cannot find an initializer for type 'String' that accepts an argument list of type '(format: String, argument: UInt32

前端 未结 1 514
天命终不由人
天命终不由人 2020-12-21 11:07

I created a playground in Xcode 6.3 (6D570) and input these following code:

import UIKit
var randum_num = arc4random_uniform(13) + 1
String(format: \"card%i\         


        
相关标签:
1条回答
  • 2020-12-21 11:31

    You just have to omit "arguments:". Try like this:

    let randum_num = arc4random_uniform(13) + 1
    String(format: "card%i",  randum_num)
    

    or simply

    String(format: "card%i",  arc4random_uniform(13) + 1)
    
    0 讨论(0)
提交回复
热议问题