How To Pass Data Between View Controllers in Swift (Xcode 11) | iOS for Beginners

Sdílet
Vložit
  • čas přidán 27. 08. 2024

Komentáře • 92

  • @iOSAcademy
    @iOSAcademy  Před 3 lety +2

    Enjoy my teaching style? Learn to build the TikTok App from scratch with my course!
    ios-academy.teachable.com/p/building-tiktok-for-ios

  • @BranGaming20
    @BranGaming20 Před 3 lety +1

    i love how you explain those different method, not just like showing only the code, thanks a lot

    • @BranGaming20
      @BranGaming20 Před 3 lety

      but please help me how to pass multiple data

    • @iOSAcademy
      @iOSAcademy  Před 3 lety +1

      Youre welcome

    • @BranGaming20
      @BranGaming20 Před 3 lety

      @@iOSAcademy its works on do single data, but i dont know how to do with 2 or more data to pass

  • @volodya-nrg
    @volodya-nrg Před 4 lety +1

    Thanks for the video tutorial. The Observer was the most interesting place.

  • @tahevol
    @tahevol Před 3 lety +2

    Thank you. This helped me a lot with NC. The concept is simple, but I was hung up for a long time getting text out of a function on one VC and into a labels on other VCs. You made the components of the NC Post and Observer system clear.

  • @arijitganguly83
    @arijitganguly83 Před 2 lety +1

    thanks... this one helped a lot

  • @mehradt8129
    @mehradt8129 Před 3 lety +1

    once again, thank you!

  • @deluxe092
    @deluxe092 Před rokem

    Thanks a lot!

  • @heliumstein1
    @heliumstein1 Před rokem

    helpful but the zoom in feature you have when presenting is disorientating

  • @chillyo5920
    @chillyo5920 Před 4 lety +2

    Thank you! I appreciate the tips!

  • @GG-hk5iz
    @GG-hk5iz Před 3 lety +2

    How do you manage to explain any concept with such a simplicity?

  • @mahmutyazar6976
    @mahmutyazar6976 Před rokem

    You're amazing. Thanks a lot!

  • @asherazeem3282
    @asherazeem3282 Před 3 lety

    That a lot bro, it is a good way for moving data from A-> B or B->A Controller.

  • @BalaaLyf
    @BalaaLyf Před 4 lety +1

    Please upload one more video for this pass data.. Multiple labels and multiple textfields.. Data transfer and save it

  • @newBoyFromGhetto
    @newBoyFromGhetto Před 3 lety +1

    very thank you!!!!!

  • @chho2612
    @chho2612 Před 3 lety +1

    both method are super advanced, to be honest not suitable for newbie , only for swift experts. but thanks for share anyway

  • @Christian031780
    @Christian031780 Před 4 lety +5

    Your videos are great, but zooming so often might be little bit distracting and hard to follow. You might want to stick with one view and make the font size bigger and it will be fine. Thank you for your videos.

    • @iOSAcademy
      @iOSAcademy  Před 4 lety

      Thanks for the feedback :) And thanks for watching!

  • @dugrut1325
    @dugrut1325 Před 2 lety

    when you messed up with the button, on the OtherViewController, at first I thought I'm really lost, how is then actually possible....?

  • @user-qr1yj6vz2y
    @user-qr1yj6vz2y Před 3 lety +1

    Very well job man :D ty

  • @RyeGuyWpg74
    @RyeGuyWpg74 Před 2 lety

    This doesn't seem to be working when I try to do it the other way. Push data from the first vc to the second. I am posting the notification but I have to do it before pushing the second view controller and the second vc never receives the notification.

  • @rafatwasef8518
    @rafatwasef8518 Před 2 lety

    Thanks A lot that is great
    I have a question how to switch to other story board from NSObject class I used what you wrote but it said no present in NSObject please help me

  • @vspianist
    @vspianist Před 3 lety +1

    i tested this on my iPhone and the keyboard doesn't dismiss, how do i dismiss the keyboard

  • @hiwottesfaye8710
    @hiwottesfaye8710 Před 4 lety +1

    Thank you

  • @andrew5834
    @andrew5834 Před 4 lety +1

    For me, I am still unable to see the completionHandler in my initial viewcontroller.
    The error says "Value type of 'ViewController' has no member 'completionHandler' " I have added public in front of the variable

  • @GG-hk5iz
    @GG-hk5iz Před 3 lety

    @iOS Academy , Really looking forward to see Swift UI stuff from your side

  • @hulkxp3020
    @hulkxp3020 Před 3 lety

    how can I do this with a switch?

  • @balakrishnasalla
    @balakrishnasalla Před 2 lety +1

    notification center not working

  • @PFSGMBH
    @PFSGMBH Před 4 lety +1

    Thanks for the excellent tutorial.
    I have used the notification solution to send an object from the second to the first viewController.
    But what about sending an object from the first to the second. I was setting the observer and a different notification name and pushed the second viewController on the stack by navigationController?.pushViewController() . But the notification does not get noted .
    Any idea how to get the object to the second ViewController ?

  • @LeagueRandomPlayer
    @LeagueRandomPlayer Před rokem

    Great Video!!! saved me, but how do you manage to do all zooms while recording? its so epic since i have bad sight, which software do you use?

  • @leninvladimirpacas6211

    Thank you so much for the tutorial, it was excellent. I love it

    • @iOSAcademy
      @iOSAcademy  Před 4 lety

      Your welcome! Make sure to subscribe for more :)

  • @maryannadelman4438
    @maryannadelman4438 Před rokem

    Good tutorial! Question: using the completionHandler version, would it be possible to have the save button on vc2 make an image on vc1 switch to another image?

  • @shoilett1
    @shoilett1 Před 2 lety

    What about using segues? Are segues considered outdated?

  • @bearishlilly4703
    @bearishlilly4703 Před 2 lety

    how does one capture a global variable data from one view controller to another without using segue or moving to a new viewcontroller?

  • @supertonyxd
    @supertonyxd Před 2 lety

    Thank you for the tutorial.
    I got one question as I am not using storyboard but XIB to do. So for the line "let vc = storyboard?.instantiateViewController(identifier: "other") as! OtherViewController" should not work for me...
    What should I do with this? Thanks

  • @theevanator9252
    @theevanator9252 Před 4 lety +1

    One question I have is how to save information in your app so that when you renter the app it’s still there

    • @iOSAcademy
      @iOSAcademy  Před 4 lety +3

      Hi there, to do this you can use User Defaults or a Database. I recently published two videos explaining each of these topics - cheers!

  • @SSQMinky
    @SSQMinky Před 4 lety

    Is there a way to do this on a macOS app, where a vc1 button can change text on vc1 and vc2?
    Basically like a text display for extended view, where vc1 controls what the text is, and it displays on vc1 and vc2. Once a button on vc1 is pressed, it changes the text on vc1 and vc2. How to make this work?

  • @PutraTrie
    @PutraTrie Před 3 lety

    how to show data from login user by json ?

  • @lokeshchinatatareddy1069

    Can you say how to do in MVVM

  • @mdhosnemobarok2293
    @mdhosnemobarok2293 Před 2 lety

    Hey Brother what is your problem? whay your video screen zoom in and zoom out more and more!???

  • @cem890
    @cem890 Před 3 lety

    Hi. I have 3 view controllers.First home, second login and third about news. They are connected with segues. And I use unwind segue for third viewController. Because when I hit back button it returns to login screen. When I use unwind segue it was working good but one problem is my login screen is still seen about 1 second. How can I solve that. Thank you.

  • @AviationMaster
    @AviationMaster Před 4 lety

    Hello! Is it possible to copy and paste code from one cocoa touch class view controller.swift to another view controller.swift?

  • @Potato-ff9ms
    @Potato-ff9ms Před 3 lety

    how do I do a conditional statement?
    i have a code that does something like this:
    input(text field) < 5 {
    (sends me to view controller2)
    }
    if-else input(text field) > 5{
    (sends me view controller1)

  • @ananyousef889
    @ananyousef889 Před 3 lety

    really thank you so much for the valuable information ,
    I am an iOS Development student , I am on my final project and I am trying to send data from a viewController (textfield and label) to a uiTabelView , can you please let me know what is the best way to do so ?

    • @iOSAcademy
      @iOSAcademy  Před 3 lety

      You are most welcome - closure sounds like the approach you want

  • @vspianist
    @vspianist Před 3 lety

    how do you store the text value in a double and pass that between view controlers

  • @stefvanzwienen608
    @stefvanzwienen608 Před 4 lety +1

    Man, I really don't get it. I followed about 10 tutorials but I never get the option 'present'. I just don't know how to change the current viewcontroller programmatically.. I just don't know what i'm doing wrong. Could you help me?

    • @iOSAcademy
      @iOSAcademy  Před 4 lety +1

      Hey, sometimes Xcode autocomplete just sucks. Try typing it in your self: self.present(, animated: true)

    • @stefvanzwienen608
      @stefvanzwienen608 Před 4 lety

      iOS Academy That actually worked 😅 thank you!!!

  • @TomGalland
    @TomGalland Před 4 lety

    Followed and finished this tutorial today! Thank you!
    I'm struggling with the next step to Passing data. If I wanted to collect data from Two View Controllers, say "Other" & "More", and then bring it back into noteViewController. How would I do that?
    Example,
    1. User clicks "OtherScreen" from note.
    2. Types in to the "OtherViewController" and clicks a "Next Page" Button
    3. Types in to the "MoreViewController" and clicks "Save"

    • @iOSAcademy
      @iOSAcademy  Před 4 lety +1

      Thanks for watching. To do what you described you have several options. You can retain the data somewhere and use closures to pass the data back like completion Handlers. You can use the delegate / datasource pattern. Or you can use the notification center pattern.

    • @BranGaming20
      @BranGaming20 Před 3 lety

      @@iOSAcademy can you make the video please

  • @viswaprasad9412
    @viswaprasad9412 Před 3 lety +1

    please stop zooming in and out
    it is highly visible when you keep it in a normal angel

  • @shotsbyjayy_4290
    @shotsbyjayy_4290 Před 3 lety

    Am I the only one getting UIRESPONDER in my assistant editor even after I create a new class for my View Controller ??

  • @sharkcraft384
    @sharkcraft384 Před 4 lety

    Where is the github repo? Btw I love ur vids

    • @iOSAcademy
      @iOSAcademy  Před 4 lety

      Thanks, I dont think I mmade one for this one

  • @Spham99
    @Spham99 Před 3 lety

    I wished you didn't zoom in as much ... It made things harder to see which file you were in, or which tab you were in etc ... Really dizzy too.

  • @AayamS
    @AayamS Před 2 lety

    Anyone else find the constant zooming in to be super frustrating?

  • @Natena
    @Natena Před rokem +1

    Stop Zooming please.. It hurts our eyes

  • @richard12345789
    @richard12345789 Před 4 lety

    I got motion sickness!! son of a gun

    • @iOSAcademy
      @iOSAcademy  Před 4 lety

      haha new videos have less zoom :)

  • @matthewreid5467
    @matthewreid5467 Před 4 lety

    this didn't work for me

  • @furmeldahyde
    @furmeldahyde Před rokem

    I had to stop watching because your constant zooming in and out was very jarring. Other than that it seemed like you were doing well explaining it.

  • @nikolaykondratyev1391
    @nikolaykondratyev1391 Před 2 lety

    OMG stop zooming !!! =)) vomit is coming out