Hi,
I'm working on a project for my university and currently my problem is, that I am not able to get data to the Pages which get called by the UIPageViewController. I've seen some disscussions about it but none of the answers do really cover this topic or show working solutions.
I can get the data to my UIPageViewController class but how do i pass it on to every page attached to it?
Thank you!
I tested this, seems to work OK.
In PageViewController, declare the var you want to pass to children (here an Int, but could be anything, as the instance of a self written data class)
class PageViewController: UIPageViewController, UIPageViewControllerDelegate, UIPageViewControllerDataSource {
var pageControl = UIPageControl()
var testVar: Int = 0
In the childView, get this data :
override func viewDidLoad() {
super.viewDidLoad()
let passedData = (self.parent as! PageViewController).testVar
print(passedData)