I have this piece of working code that saves data to Firebase:
let locRef = locationRef.childByAutoId()
let locItem = [
senderId : [
"location": getLocationID()
]
]
And I want to retrieve the user's (identified by senderID) "location".
I want to call the data from another function and present it where appropriate, check my comments in the code below:
// Retrieve data from firebase here
let message = messages[indexPath.item] // 1
// Call data I have retrieved below with message
let text = "Sending from: " + // User Location
if message.senderId == senderId { // 2
return nil
} else { // 3
return NSAttributedString(string: text)
}
What is the syntax that would allow me to do this?
Thanks!