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
Swift 如何使用inout参数而不是显式值更新其作用域之外的变量_Swift_Firebase_Swift3 - Fatal编程技术网

Swift 如何使用inout参数而不是显式值更新其作用域之外的变量

Swift 如何使用inout参数而不是显式值更新其作用域之外的变量,swift,firebase,swift3,Swift,Firebase,Swift3,我目前正在使用firebase,需要更新另一个swift类中声明的全局变量,现在唯一需要做的就是使用inout参数。但是,firebase快照给了我一个不明确的数据快照,我得到了一个错误。下面是我收到的错误。任何帮助都会很棒 func changeYourVariable( theString: inout String , indexPaths : Int) { self.DatabaseHandle = ref.child("Frontpage").child(String(inde

我目前正在使用firebase,需要更新另一个swift类中声明的全局变量,现在唯一需要做的就是使用inout参数。但是,firebase快照给了我一个不明确的数据快照,我得到了一个错误。下面是我收到的错误。任何帮助都会很棒

func changeYourVariable( theString: inout String , indexPaths : Int) {
    self.DatabaseHandle = ref.child("Frontpage").child(String(indexPaths)).observe(.value, with: { (TheCategory) in
        theString = TheCategory.childSnapshot(forPath: "Category").value as! String

    })
}
我得到一个错误,说“转义闭包只能通过值显式捕获输入参数”

演示如何在转义闭包中修改引用传递变量的可能重复项。演示如何在转义闭包中修改引用传递变量的可能重复项。