Code Monkey home page Code Monkey logo

Comments (9)

aslanyanhaik avatar aslanyanhaik commented on June 7, 2024

Hey @surayashivji good question. When ViewController is instantiated ViewDidLoad method is called. Check FeedVC. I'm calling fetchItemsList method to download items. You can call the method to download data here.
Same is true for ViewDidAppear. After selecting tab ViewControllers appears and starts to download images. However relying on ViewDidAppear method is not a good idea since we are instantiating ViewControllers programmatically. I will suggest you to call method to load data once viewControllers are instantiated and added to collectionview. Check "MainViewController" line 85.

from youtube-ios.

aslanyanhaik avatar aslanyanhaik commented on June 7, 2024

P.S. Don't hesitate to ask any questions. Will be happy to answer 😊

from youtube-ios.

surayashivji avatar surayashivji commented on June 7, 2024

Hi! Thanks for the great information.

If I need to load more data every time the tab is selected (ie load more posts from the database, or change the content depending on what table view row was selected), how should I go about loading the data?

Thank you!!

from youtube-ios.

aslanyanhaik avatar aslanyanhaik commented on June 7, 2024

it that case you should keep strong pointer to that viewController and directly call a method. Like this way.

var vc: MainViewController()

override viewDidLoad{
super.viewDidLoad()
let viewController = self.storyboard?. instantiateViewController(withIdentifier: "name") as! MainViewController
// you should point to this vc
self.vc = viewController
}

//later if you want to call a method to get data

MainViewController.fetchData()

// where fetchData is a method in that ViewController to download something

from youtube-ios.

surayashivji avatar surayashivji commented on June 7, 2024

Hi aslanyanhaik! I apologize for my late follow up-- happy new year!

I tried keeping the strong pointer to my ProfileViewController (the view controller I'm trying to load data in each time its tab is selected), but haven't been able to get it working.

I'm trying to load new data each time the last tab, ProfileViewControler.swift, is selected.

For reference, I'm working on this project: https://github.com/surayashivji/PotterPics

Any idea how to integrate this implementation?

All of your help is much appreciated! :)

from youtube-ios.

aslanyanhaik avatar aslanyanhaik commented on June 7, 2024

Happy new year :) Let me check the source code

from youtube-ios.

aslanyanhaik avatar aslanyanhaik commented on June 7, 2024

Hey Suraya, seems I can't run the app. Do you want to do a screencast? So we can together go through all issues

from youtube-ios.

surayashivji avatar surayashivji commented on June 7, 2024

Oh how odd-- what's the error that you're getting? Sure that'd be awesome!

from youtube-ios.

aslanyanhaik avatar aslanyanhaik commented on June 7, 2024

there are some APIs deprecated in iOS 10, and also can't login with Facebook
screen shot 2017-01-04 at 7 31 04 pm

my skype id: aslanyanhaik

from youtube-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.