This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
0
Swift Firebase returning data as OrderedDictionary
Post Flair (click to view more posts with a particular flair)
Post Body
Wondering if anyone has ever used Firebase and tried to return an OrderedDictionary. For me, specifically on the ingredientsItem, I am not returning anything. Meanwhile If I switch to as? [String: String]
it works.
Wondering why OrderedDictionary isn't throwing up any errors, but also isn't grabbing the data
func grabRecipes(){
//grab current user
guard let uid = FirebaseManager.shared.auth.currentUser?.uid else {
return
}
FirebaseManager.shared.firestore
.collection("users")
.document(uid)
.collection("userRecipes")
.addSnapshotListener { (snapshot, err) in
guard let documents = snapshot?.documents else{
print("no documents present")
return
}
self.recipes = documents.map { (querySnapshot) -> RecipeItem in
let data = querySnapshot.data()
let recipeTitle = data ["recipeTitle"] as? String ?? ""
let ingredients = data ["ingredientItem"] as?
OrderedDictionary<String,String> ?? ["": ""]
print(ingredients)
return recipe
}
}
}
}
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 2 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/swift/comme...