I have a firebase function that returns an object, at first it returned one item within the object that was just a boolean. When it arrives from the .call function within the swift app, it is rather a one or a zero. Which is fine when casting the string to a boolean as it will just turn into true or false. However, adding more values on this object from the Firebase function and trying to cast the string to a string. It seems to break my Bool as well as the String also not being cast down. It seems in the docs that they always cast down to any. I know this is probably a pretty simple question to answer but can't wrap my head around it.
guard let rawTime = (result?.data as? [String: Bool])?["serverTime"] else { return }
print(rawTime)
guard let rawString = (result?.data as? [String: String])?["example"] else { return }
print(rawString)
My object coming from the firebase function is:
Optional({
example = lala;
serverTime = 1;
})