Value of type 'ViewController' has no member

So, im trying to pass data from one view controller into a tableview on a second view controller

However when I try to set the destination in the prepare segue function of the first view controller I receive an error: Value of type 'LibraryMovieViewController' has no member 'lib movie'

Initial View controller (attempts to send movieTitle to second view controller)

 var movieTitle: String!

 var movieReleaseDate: String!
   func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        let DestViewController: LibraryMovieViewController = segue.destination as! LibraryMovieViewController
        DestViewController.libMovie.title = movieTitle
        DestViewController.libMovie.release = movieReleaseDate


struct  libMovie {

//let mainImage: UIImage

 let  title: String

 let release: String


 class  LibraryMovieViewController: UIViewController {

 @IBOutlet weak   var  TableView: UITableView!

 var  dataSource: [libMovie] = []

 var movieTitle: String!

 var  movieRelease: String!

 func loadDataSource(){
        dataSource.append(libMovie(title: " \(String(describing: movieTitle))", release: " \(String(describing: movieRelease))"))

extension LibraryMovieViewController: UITableViewDataSource, UITableViewDelegate{
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        return 115
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return dataSource.count
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) ->  UITableViewCell {
        guard let movieCell = tableView.dequeueReusableCell(withIdentifier: "libCell", for: indexPath) as? LibraryMovieTableViewCell else {
            return UITableViewCell()
        let libMovie = dataSource[indexPath.row]
        movieCell.cellTitleLabel.text = "Movie Title:\(libMovie.title)"
        movieCell.cellReleaseLabel.text = "Release Date:\(libMovie.release)"
        return movieCell

I have tried sending the data to the variables movieTitle and movieRelease and setting NumberOfRowsInSection to 1 but this returns nil

I receive an error: Value of type View Controller has no member libMovie
DestViewController.libMovie.title = movieTitle

DestViewcontorller.datasource also produces and error -> Cannot assign value of type 'String?' to type '[libMovie]'

It means exactly what it says. Your VC has no stored property libMovie therefore you can't do that.

A few more things to improve code readability:


Whenever you define a new structure or class, you define a new Swift type. Give types UpperCamelCase names (such as SomeStructure and SomeClass here) to match the capitalization of standard Swift types (such as String , Int , and Bool ). Give properties and methods lowerCamelCase names (such as frameRate and incrementCount ) to differentiate them from type names.


And this: - API Design Guidelines