Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ios中编写速记符号?_Ios_Swift - Fatal编程技术网

如何在ios中编写速记符号?

如何在ios中编写速记符号?,ios,swift,Ios,Swift,有没有办法用速记写下以下内容 公共变量testvar=字典 公共变量testone:Dictionary=[:] 如果我能用简写的方式来写这篇文章,那将是非常有帮助的。如果没有结尾附加(),第一篇文章就不能按原样编译。您所能获得的最短时间是: public var testVar = [String:Any]() 同样,第二个可能是: public var testOne: [String:Any] = [:] 或 根据您使用这些文件/类型的方式,您还可以根据苹果的文档省略public 不能

有没有办法用速记写下以下内容

  • 公共变量testvar=字典
  • 公共变量testone:Dictionary=[:]

  • 如果我能用简写的方式来写这篇文章,那将是非常有帮助的。如果没有结尾附加
    ()
    ,第一篇文章就不能按原样编译。您所能获得的最短时间是:

    public var testVar = [String:Any]()
    
    同样,第二个可能是:

    public var testOne: [String:Any] = [:]
    


    根据您使用这些文件/类型的方式,您还可以根据苹果的文档省略
    public

    不能将数据类型分配给变量。只能使用


    我希望这能有所帮助

    public-var-testvar:[String:Any]
    public-var-testvar=[String:Any]()
    public var testOne = [String:Any]()
    
    public var testVar : [String: Any]    
    public var testOne = [String: Any]()