I have this code in one of my TableViewControllers:
import UIKit
import ReSwift
class ProfileTableViewController: UITableViewController, StoreSubscriber {
var user: User?
@IBOutlet weak var userLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
print("This code definately works")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func newState(state: AppState) {
self.user = state.user
self.userLabel.text = self.user?.displayName;
}
}
However, the newState() function is never called.
Is there anything else I need to do?
The weird part is I have another ViewController in my code, and newState works fine there. It's just this one that doesn't work.
I just tried to do an even simpler case, still failed (Yes I have binded my view controller class to the storyboard view):
import UIKit
import ReSwift
class HomeViewController: UIViewController, StoreSubscriber {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func newState(state: AppState) {
print(state)
}
}
Ignore me, I forgot to add store.subscribe(self)
@dolanmiu welp thanks, just had the same issue :)
Most helpful comment
@dolanmiu welp thanks, just had the same issue :)