Filter, Map, Reduce - Swift - iOS Interview Questions

Поділитися
Вставка
  • Опубліковано 20 гру 2024

КОМЕНТАРІ • 118

  • @seanallen
    @seanallen  4 роки тому +2

    Watch Next - iOS Take Home Project - Job Interview Practice - Free Preview - ua-cam.com/video/MSIe2y6Fee8/v-deo.html

  • @pkasetti
    @pkasetti 7 років тому +45

    This channel is providing so much value to aspiring iOS developers like me. Thanks so much and keep up the great work!

    • @seanallen
      @seanallen  7 років тому +3

      Thanks Pranav! Glad you're enjoying it. More videos on the way!

    • @jaiswalji1
      @jaiswalji1 7 років тому +3

      For me too

    • @stevengao8345
      @stevengao8345 7 років тому

      for me too, right to the point, easy for beginners to understand. some other instructors shoot more times than this, and at the end i was still confusing, can't wait to hear Mr.allen talk about closure and its related stuff, read from lots of youtuber still confuse me

  • @Tenly2009
    @Tenly2009 5 років тому +3

    Great explanation of 3 concepts I’ve been avoiding for over a year. I now understand what they are for and am not afraid of them.
    I do wish though, that you had spent a minute showing us how to use them with the structure that appears when you hit “enter” on the placeholders - as well as how and why the method you used was equivalent. People do something similar with “where” clauses - and also don’t explain how or why it’s equivalent to ignore the Apple documentation and replace with a much easier to read closure.

    • @seanallen
      @seanallen  5 років тому +1

      Thanks for the note... I'll keep that in mind next time. But truthfully, when I learned, I learned the shorthand closure syntax... so that's pretty much the only way I've ever used them.

  • @bigmtnstudio
    @bigmtnstudio 6 років тому +13

    Great stuff! Thanks, Sean. Had this on my "Watch later" list for a while and am finally catching up! I can use this info in my current project.

    • @seanallen
      @seanallen  6 років тому +5

      Thanks Mark! Must have been in there for a while, lol.

  • @DadBodSwagGod
    @DadBodSwagGod 5 років тому +1

    This isn’t very useful in any q&a stuff, but VERY useful in coding problems. If you can just whip this out without having to make a loop on a whiteboard, you’ll save minutes at a time, and really impress the interviewer

  • @meetthanki5218
    @meetthanki5218 4 роки тому +1

    great work sean !! I was looking on the internet for reduce in swift, but your method of explaining is so great. Keep up the good work!!

    • @seanallen
      @seanallen  4 роки тому +1

      Glad you enjoyed it, Meet!

  • @MrMurmandramas
    @MrMurmandramas 3 роки тому

    Wow, the gist of these topics is explained so much easier. I started reading the Map chapter of a textbook and my brain wanted to 🤯 .

  • @sophiabnrm8730
    @sophiabnrm8730 7 років тому +1

    Sean great tutorial once again but you did not tell us why you get this "lldb_expr" when you print out your answer at 2:12.
    Would appreciate an answer!

    • @seanallen
      @seanallen  7 років тому

      It has to do with Swift Playgrounds and empty classes. I actually wasn't sure myself, so I had to look it up real quick. Rather than type out the long answer here, you can check read more about it here: stackoverflow.com/questions/31020725/what-is-lldb-expr-in-swift-playground

  • @seanallen
    @seanallen  7 років тому

    Have any questions about Filter, Map, Reduce in Swift? Leave a comment, and I'm happy to help!

    • @MikePujol
      @MikePujol 7 років тому +1

      No questions. Just gotta say thanks for the reduce function tip ^_^

    • @seanallen
      @seanallen  7 років тому

      +Mike Pujol You're welcome!

  • @conormosier8140
    @conormosier8140 6 років тому +1

    these videos are so awesome man I'm trying to learn on treehouse and sometimes how they explain concepts just doesn't resonate with me but these videos make it all much easier to digest

    • @seanallen
      @seanallen  6 років тому

      That's great to hear, Conor. Happy to hear the videos are helping!

  • @akshaysomkuwar4758
    @akshaysomkuwar4758 3 роки тому +1

    Nicely explained..👌
    I was confusing in Map, Reduce & Filter so again watched the video and everything is revised now..Thank you..🙏

    • @seanallen
      @seanallen  3 роки тому +1

      Glad it was helpful, Akshay!

  • @weepingwillow2056
    @weepingwillow2056 3 роки тому

    Very helpful higher level functional programming enhancements of Swift, map reduce and filter are very helpful to write elegant code. Applied on top of sequences such as Arrays and collections gives us developer so much power to write clear and concise code

  • @nileshjdarji
    @nileshjdarji 5 років тому +2

    Oh Wow! This cleared up cloud of smoke over my head. Very nicely explained. Thanks a lot Sean.

  • @davidlintin
    @davidlintin 5 років тому +1

    Again a great video Sean. Many thanks. Have just implemented this in my project as I have a collection view scrolling horizontally in a tableView which I use to filter the data in the tableView dataSource

    • @seanallen
      @seanallen  5 років тому

      Glad you enjoyed it, David!

  • @MarcosFelipejchrist
    @MarcosFelipejchrist 6 років тому +1

    Thanks for video .
    The video is excellent , audio is great and you can show with the both ways .
    Congratulations for your work.

    • @seanallen
      @seanallen  6 років тому

      Glad you enjoyed it, Marcos!

  • @Pawankumar-rb3bg
    @Pawankumar-rb3bg 5 років тому +1

    Hi Sean
    I love your video,
    your video help me understand lots of concepts. Thank you for providing us great tutorial

    • @seanallen
      @seanallen  5 років тому

      Thanks Pawan. Glad you liked it!

  • @hamadminmgr
    @hamadminmgr 7 років тому +1

    Great work! I am an aspiring web/iOS developer but as yet no job. Can't decide on which path to take.

    • @seanallen
      @seanallen  7 років тому

      I vote iOS... but I'm partial 😎

  • @Dennisvm82
    @Dennisvm82 7 років тому +1

    Awesome video, Sean! Glad I subscribed to your channel, because you go over all the small parts of the Swift programming language in a very clear and concise manner. You and Brian make a very good team :-)

    • @seanallen
      @seanallen  7 років тому

      Thanks for the kind words, Dennis! Glad you are enjoying the channel!

  • @miko999x
    @miko999x 6 років тому +2

    thanks for this awesome videos Sean, maybe something about JSON parsing in the future?

    • @seanallen
      @seanallen  6 років тому

      Thanks Miko! That video has been on my todo list for a while now. I'll get there soon... got a lot of video ideas.

  • @gevorgnikoghosyan7252
    @gevorgnikoghosyan7252 4 роки тому +1

    thank you Sean :) i couldnt understand reduce from swift docs :) now i'm on fire :)

    • @seanallen
      @seanallen  4 роки тому +1

      Happy to help clear that up for ya 😀

  • @ammadakhtar1706
    @ammadakhtar1706 7 років тому +1

    this is so amazing never knew this stuff and very clear explanation... i am seeing this old video n i believe with time you are going to nail it (Y)

    • @seanallen
      @seanallen  7 років тому +1

      Thanks for the kind words, Ammad! Happy the video help you.

  • @nileshjdarji
    @nileshjdarji 3 роки тому

    There are two other higher order functions that are similar but kind of confusing. They are Flat Map and CompactMap. Are you planning a video for these??

  • @tbg6nb
    @tbg6nb 5 років тому +1

    Is return statement really needed ? Code below works fine
    let someNums = [3, 1, 6]
    let filteredNums = someNums.filter({$0 > 2})
    print(filteredNums) //[3, 6]

  • @ciaraverma2379
    @ciaraverma2379 4 роки тому

    You explained it very well.Thanks

  • @14BIDISHA
    @14BIDISHA 4 роки тому +1

    Your channel is wonderful !! :) Could you please create a tutorial on AlamoFire? It seems to be a lot in use by companies. Thanks

    • @seanallen
      @seanallen  4 роки тому +1

      Glad you are enjoying it, Bidisha! I have an alamofire tutorial on my to-do list. It's just a VERY long list.

  • @neutrino10
    @neutrino10 6 років тому +1

    Hey Sean, your tutorials are really helpful. I'd like to know in this example how would you sort the myDevices array based on prices?

  • @Fallen_Zen
    @Fallen_Zen 6 років тому +3

    To not have gibberish in the output it's nice to conform to CustomStringConvertible protocol and add description property to the object.
    struct Device : CustomStringConvertible {
    var type: String
    var price: Float
    var color: String
    var description: String {
    return "Type: \(type), Price: \(price), Color: \(color)"
    }
    }
    Print statement will be much cleaner 😀
    [Type: iPhone, Price: 799.0, Color: White, Type: iPhone, Price: 699.0, Color: Black]

    • @seanallen
      @seanallen  6 років тому

      Thanks for the tip, Piotr!

  • @shubhambairagi4942
    @shubhambairagi4942 6 років тому

    Hey Sean, I follow your videos to make my code robust and reach to standard. Can you please make a video to clarify the difference between Array and Set.

  • @subinrevi1
    @subinrevi1 7 років тому +1

    Great tutorial Sean..thank you.

    • @seanallen
      @seanallen  7 років тому

      Glad you enjoyed it, Subin!

  • @vengateshkr
    @vengateshkr 7 років тому +2

    Why did you use a struct instead of class for this example?

    • @seanallen
      @seanallen  7 років тому

      Because it was just simple data. But to be honest, there's really no thoughtful reason behind it. I just needed an object to work with real quick for the Filter, Map, Reduce examples. That was the focus of the video.

  • @CodingWithNoel
    @CodingWithNoel 2 роки тому

    Thank you for this video!

  • @jaiswalji1
    @jaiswalji1 7 років тому +2

    4:16 How did you do that

    • @seanallen
      @seanallen  7 років тому +4

      Commenting out multiple lines of code? Just highlight the lines you want to comment out, and then hit Command + /

  • @JasonMitchellAZ
    @JasonMitchellAZ 6 років тому +2

    Another great tutorial 👍

  • @Ram_9292
    @Ram_9292 6 років тому

    Awesome videos, Sean! Glad I subscribed to your channel, because you go over all the small parts of the Swift along with source code (~~

    • @seanallen
      @seanallen  6 років тому

      Thanks for the kind words, Ram 👍

  • @sachinyadav-wb6nh
    @sachinyadav-wb6nh 7 років тому +1

    That's really amazing video. Thx for sharing your knowledge with us

    • @seanallen
      @seanallen  7 років тому

      Thanks Sachin! Glad you enjoyed the video. More on the way!

    • @sachinyadav-wb6nh
      @sachinyadav-wb6nh 7 років тому

      Sean Allen I'm a student I don't have much knowledge about the technology in market.
      I'm doing iOS development with swift from past 2years .
      But some of my friends are shifting towards React-Native . I love swift I don't want to move to React . What you think about future safety with swift .

    • @seanallen
      @seanallen  7 років тому +1

      +sachin yadav I can only speak for the U.S. market. Your country may be different. But in Silicon Valley, you're perfectly fine focusing on iOS development (Swift). There's a time and place for React Native, for sure, but ultimately I believe native is the way to go. I also got asked this question during my latest livestream, and I talk about it more there. Check it out.

  • @TheGhousesgb
    @TheGhousesgb 7 років тому +1

    Keep Going Sean Allen, Need more like this...
    Could you have a video on enum, tuple, sets. their pros and cons
    ThanXs in Adv (Y)

    • @seanallen
      @seanallen  7 років тому +4

      Thanks for the kind words, Ghouse! I actually just added an enum video to my list today. Coming soon!

  • @arturmavlyuchenko7647
    @arturmavlyuchenko7647 6 років тому +1

    Thanks Sean. Great videos, like the content. Just a little remark there.

    • @seanallen
      @seanallen  6 років тому

      Thanks for the kind remark, Artur

  • @donottalk4138315
    @donottalk4138315 2 роки тому

    Can someone explain to me, please, why Xcode completion for reduce() is a loooong gibberish, and in practice it’s just parameter and operator? Is there a nuance reason for long gibberish proposal that Xcode give? I’m really curious.

  • @diliptilonia
    @diliptilonia 7 років тому +1

    congratulations for 1k

    • @seanallen
      @seanallen  7 років тому

      Thanks Dilip! I appreciate the support. It's been a fun ride so far. More to come!

    • @diliptilonia
      @diliptilonia 7 років тому +1

      hey Sean i found this website is so useful for beginner,
      www.techotopia.com/index.php/Working_with_Array_and_Dictionary_Collections_in_Swift
      so can you share the stuff where you learned or could you make a video about how did you learned Swift programming or if you already done it then plz send a link :)

    • @seanallen
      @seanallen  7 років тому +1

      I did a video that might help out about how I would learn Swift differently if I have to do it over again. ua-cam.com/video/wb6-liariF4/v-deo.html

  • @abdouett3676
    @abdouett3676 7 років тому +1

    Thank you for the superb work and effort. I hope that you make videos about what's new in iOS11.

    • @seanallen
      @seanallen  7 років тому

      Hey Abdou, glad you enjoyed the video. I've started on some iOS 11 videos, not sure if you've seen them. But you can check out my WWDC playlist. It as my Keynote Reaction Video, Swift 4, Xcode 9, ARKit, and new Navbars in iOS 11. ua-cam.com/play/PL8seg1JPkqgGJn85LB3UJDpOwQ-FAFhuJ.html

    • @abdouett3676
      @abdouett3676 7 років тому +2

      I have seen them all and I thank you for that. I hope that you put the light on more profound concepts, notably the networking, what's new in Foundation ... Thanks

    • @seanallen
      @seanallen  7 років тому

      Ah, I got ya. Thanks for the recommendations. I have a VERY long video idea list and there's only so much time. However, when people request specific topics, I bump them up the list a little bit. I've heard the "What's New in Networking" is a good WWDC session to watch, but I haven't gotten around to seeing it yet. Maybe I'll do that tonight.

    • @abdouett3676
      @abdouett3676 7 років тому +1

      I saw both sessions (Networking 1 & Networking 2). Life becomes easier with the improvements introduced but I wish to see them in a concrete example. Thank you

  • @AsangaRamanayake
    @AsangaRamanayake 5 років тому +1

    Very helpful... Thanks

  • @dolphinmoto3226
    @dolphinmoto3226 4 роки тому +1

    Thank you so much!!! 🔥👍

  • @ewaboer7297
    @ewaboer7297 3 роки тому

    hey Sean, is your course up to date? sorry if its a stupid question :)

    • @seanallen
      @seanallen  3 роки тому +1

      Not a stupid question at all :). This depends on which course you are referring too as 2 of them were created in iOS 13 and the SwiftUI ones were created in iOS 14. That being said, I'm working on an iOS 15 update for ALL of them which will be released at the beginning of October (it will be a free update for those that already own the courses).

    • @ewaboer7297
      @ewaboer7297 3 роки тому

      @@seanallen Launchpad and fundamentals , thank you for your quick reply

  • @Himegw
    @Himegw 4 роки тому

    Hi Shean. I just found your channel. Its great. I have a question about map. its an example from Swift on Sundays book but i cant seem to figure out how to do this.
    I have a loop and i want to rewite it ising map
    The problem is i get an emty Array of objects:
    var timeZones = [TimeZone]()
    var selectedTimeZone = 0
    let identifiers = TimeZone.knownTimeZoneIdentifiers
    for identifier in identifiers {
    if let timeZone = TimeZone(identifier:identifier) {
    timeZones.append(timeZone)
    }
    }
    print(timeZones)
    let identifier2 = timeZones.map({return timeZones.append($0)})
    print (identifier2)

  • @iphyzll1091
    @iphyzll1091 7 років тому +1

    Awesome, congratulations for hitting 1000 subs mark already ! Hopefully you get patreon as soon as possible, so i can really appreciate everything you are doing! Are you planing on doing some closures explanation aswell ? :)

    • @seanallen
      @seanallen  7 років тому +2

      +iPHYZLL , Thanks for the congrats, iPHYZLL. You were one of the first few subs. It's funny you mentioned Patreon, because I've been planning it out the past week or so. Just need to actually create the page and get it up and running. Closures are on the "to-do" list but admittedly, pretty low on the list. Soooo many videos, so little time, lol.

    • @iphyzll1091
      @iphyzll1091 7 років тому +2

      Better later than never, can't wait :) Thank you for patreon update aswell. Have a nice day Sean!

    • @jaiswalji1
      @jaiswalji1 7 років тому +1

      Ya, could we have a closure explanation as well??

    • @seanallen
      @seanallen  7 років тому +2

      Maybe I'll move the video up the list a bit since it's being requested :)

    • @seanallen
      @seanallen  7 років тому

      Hey iPHYZLL, just launched the Patreon page here: www.patreon.com/seanallen. It sounds like you're familiar with Patreon, so I'd love to hear if you have any feedback. (On things like goals, rewards, etc...)

  • @MedAmineSouaiaia88
    @MedAmineSouaiaia88 6 років тому +2

    Thank you ! you are the man !

    • @seanallen
      @seanallen  6 років тому

      I appreciate that, Med!

  • @Daniel-sz2lq
    @Daniel-sz2lq 7 років тому +1

    Where the hell did the 1K subs come from?! Well done man

    • @seanallen
      @seanallen  7 років тому

      +Daniel haha, thanks Daniel. My WWDC videos about Swift 4 and Xcode 9 are ranking pretty well for me.

  • @chmziaurrehman
    @chmziaurrehman 7 років тому +1

    Awesome channel 👍🏻❤️

    • @seanallen
      @seanallen  7 років тому

      Thanks! I appreciate the kind words!

  • @stevengao8345
    @stevengao8345 7 років тому

    can Map go through a Post array, there is a type in each Post object called timestamp(when user create his post), and only take objects that its timestamp is within 7 days? i think it may require one extra step (if condition )to do to it. anyone got any idea? thanks

  • @bibinjacob123
    @bibinjacob123 7 років тому +1

    gave it a thumbs up.. 👍

    • @seanallen
      @seanallen  7 років тому

      Awesome, Bibin! Glad you enjoyed it!

  • @sathamhussain9299
    @sathamhussain9299 7 років тому +1

    Excellent.

    • @seanallen
      @seanallen  7 років тому

      Glad you enjoyed it Satham!

  • @Himegw
    @Himegw 4 роки тому

    can u help me, please?

  • @mohamedchief1015
    @mohamedchief1015 7 років тому +2

    the best man ;)

  • @shubhammishra-zz1os
    @shubhammishra-zz1os 6 років тому

    Talk to me man, i will be more than happy

  • @学习使命
    @学习使命 4 роки тому

    你胡子哪😁😁😁😁