I get Fatal error: Unexpectedly found nil while unwrapping an Optional value Error.
on ViewController.swift.
I initiate serviceController.swift to get json data.
appDelegate.swift
class AppDelegate: UIResponder, UIApplicationDelegate {
var mainView=ViewController()
...
..
serviceController.swift
self.appDelegate.mainView.gettingData(result:results)
ViewController.swift
public func gettingData(result:Array<String>){
print("gettingData")
print(self.currentTime) //it is nill
print(self.userId)
print(self.name)
self.name.text="ss" . //here error Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
maybe It's because initiating on AppDelegate.swift? then, How can I pass data from servicecontroller to viewController.swift?