How to transfer data of Prefs values ​​from the view controller to the internal cell of the table view with fast 3?

In Home.swift ,
I am writing code for data transfer. Here is the code.

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let mainThemeList = mainHomeThemeTable[(indexPath as NSIndexPath).row] DispatchQueue.main.async { self.prefs.set(mainThemeList.main_associated_url, forKey: "associated_home_url") self.prefs.set(mainThemeList.main_name, forKey: "associated_name") } let cell = tableView.dequeueReusableCell(withIdentifier: "homecell") as! HomeCategoryRowCell DispatchQueue.main.async { cell.categoryTitle.text = mainThemeList.main_name cell.mainAssociatedURL.text = mainThemeList.main_associated_url debugPrint("Sandy Name:::::\(mainThemeList.main_name)") debugPrint("Sandy URL:::::::\(mainThemeList.main_associated_url)") cell.collectionView.reloadData() } return cell } <br> 

Debug Result:

 "Sandy Name:::::Action" "Sandy URL:::::::search/filters?collections=1,2" "Sandy Name:::::Drama" "Sandy URL:::::::search/filters?collections=1" "Sandy Name:::::lastest Videos" "Sandy URL:::::::search/filters?collections=1,2" "Sandy Name:::::Breaking News" "Sandy URL:::::::search/filters?collections=3" 


In HomeCollectionViewCell.swift ,

  func getAssetsData(){ SwiftLoading().showLoading() debugPrint("Call Assests") if Reachability().isInternetAvailable() == true { associated_url = prefs.value(forKey: "associated_home_url") as! String! debugPrint("MP URL :::\(associated_url)") print("MP NAME::::\(UserDefaults.standard.value(forKey: "associated_name")!)") } } 

When I type the MP URL, the result is only the Action and Drama categories.
Do not show other Latest videos, Latest news.
Am I writing something wrong?

0
ios swift3 sharedpreferences value
Jun 21 '17 at 5:17
source share

No one has answered this question yet.

See similar questions:

61
Swift 3 saving and retrieving a user object from userDefaults
9
Loop data in a UICollectionView (or UITableView) swift

or similar:

1300
Transferring data between view controllers
2
TableView does not display text with JSON data from an API call
one
Transferring data between table views
0
The data passes the table view cell to the display controller of the tab bar in Swift
0
Swift 3.0 Transferring Data Between a View Controller
0
Transferring data from a table view to view the controller
0
How can I create a cell in a tableview with multiple fields?
0
Update or reload UITableView after completion of uninstall action in verbose view
-one
how to pass bool value from table cell class to table view class in swift 3?
-one
Change pref. value in Swift 3



All Articles