Filter, Map, Reduce, CompactMap, FlatMap - Swift - iOS Dev Interview Questions

preview_player
Показать описание

Explaining Filter, Map and Reduce in Swift is a very common iOS Dev interview question. In this tutorial I'll walk you through how Filter, Map and Reduce work and how to chain them together for more complex examples. I also show you how compact map and flat map work.

This tutorial was created using Xcode 14 and iOS 16.

iOS Developer Interview Questions Playlist:

My iOS Dev Courses:

My Closures Video:

Twitter:

Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):

Paul Hudson's Hacking With Swift:

Donny Wals - Combine:

Mark Moeyken’s SwiftUI Books:

#swift #softwaredeveloper #iosdeveloper

Timestamps:
0:00 - Filter, Map, Reduce
0:45 - Filter
3:02 - Map
4:35 - Reduce (simple)
6:05 - Reduce (on property)
7:17 - Chaining
10:18 - Compact Map
11:21 - Flat Map
Рекомендации по теме
Комментарии
Автор

Sean, I am a long time old school programmer: VIC-20, Commodore 64 BASIC, 6502 Assembler then eventually Java, C# in my second career as a developer. I made the painful switch to web design with node and JavaScript a few years ago. Swift really seems to be the best world between these dynamically typed languages and a solid, strongly typed, compiled language. As for higher order functions... I don't know nearly enough about Swift but I find they're really syntactic sugar with a lot of assumptions made on input arguments. In JS, they actually run slower than lower order loop functions. The way you've explained this and other content is brilliant! I'm happy to subscribe and learn more. You're an excellent teacher!!!

ChrisJarzynka
Автор

The way you explained trailing closures in this made something finally click in my brain! I have no idea how it was able to confuse me for so long – it’s just so simple. Thank you!

DaveDDD
Автор

Finally this video clicked for me... Simple examples makes you understand... i have watched 3 other videos across YouTube to understand high order functions but they had stupid azz examples i couldn't understand a freking thing...

Spacer-lj
Автор

Thanks for the shares. You have many followers from Turkey. Even though I watch with automatic subtitles, I learn a lot.

ANILAVCI
Автор

Big Love Sean, THANK YOU, you and Afraz are the best <3

mahmoudhashim
Автор

Excellent explanation, as usual. Thank you!

ellen_kapii
Автор

smart explanation, clear language! very efficient.. very.. ! 👏🏻

Rayana_rei
Автор

Never knew about a reduce, just learned it today. Thanks, sean. I've been doing it the hard way all this time.

kd_techniques
Автор

Thank you so much for putting this together! Especially for map and reduce!

tylerwatt
Автор

Cool video. Learned some new things today. Thank you!

milanfdl
Автор

Great job Sean, before this I really got stuck which one is

soheilpakgohar
Автор

You can use keypaths with these high level functions. Makes for great readability!

gakkieNL
Автор

How about Zip? How does it work and when is useful?

xfabiosoft
Автор

Amazing you are the best, Thanks for being one of the best is swift 👍

ahmednemo
Автор

Awesome 🎉
Is there any plan for portfolio review? I’d love to hear your opinion about my website.
Thank you in advance 😊

mkhasson
Автор

cool vid, but I believe that $0 and $1 when reducing does not refer to "this and next iteration", but to "current result and current iteration" - isn't that right? :) because here you keep handling constantly "accumulating current result" with each collection's element.

filipchwastowski
Автор

Great explanations, really appreciate it.

A few reactions if you're open to such things:
1. Using Double for currency values will work 99.99% of the time. It's that .01% that will drive you crazy.

2. I wouldn't use the for loop as a tool to explain filter/map/reduce. Your original explanation is great and more than sufficient. Adding discussion of the for loop way of calculating will confuse a certain percent of viewers, and slow down almost everyone.

Patrick
join shbcf.ru