Hi @scotteg
just want to know when I should use flatMap and can I use flat map without having return type observable
flatMap {
$0.score.asObservable()
}
I need some reason to implement it. Please help me .
Thanks
~
Hi @scotteg
just want to know when I should use flatMap and can I use flat map without having return type observable
flatMap {
$0.score.asObservable()
}
I need some reason to implement it. Please help me .
Thanks
~
@lohanrakesh. Thanks very much for your question! With respect to using flatMap:
When you need to transform the contents of an array of arrays, into a linear array use flatMap:
eg.
let users: [User] = ā¦
let allEmails = users.flatMap { $0.emails }
In the above example, Iām not using a return type observable, so this should be a good example.
I hope this helps!
All the best!
This topic was automatically closed after 166 days. New replies are no longer allowed.