I am currently using firebase and I need to update a global variable declared in another swift class, the only was I now is to use an inout parameter. However, the firebase snapshot gives me a data snapshot that is not explicit and I get an error. Attached below is the error I get. Any help would be awesome!
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
})
}
And I get an error that says "escaping closures can only capture input parameters explicitly by value"