Group Group Group Group Group Group Group Group Group

Bow Ties - How does the app read SampleData.plist?


#1

I’ve looked all over the project, and I can’t find any setting or code that would cause the app to read data from SampleData.plist.


#2

@pietrorea Can you please help with this when you get a chance? Thank you - much appreciated! :]


#3

Check ViewController.swift

func insertSampleData()

Cheers NJ


#4

ViewController.swift:

import UIKit
import CoreData

class ViewController: UIViewController {

  // MARK: - IBOutlets
  @IBOutlet weak var segmentedControl: UISegmentedControl!
  @IBOutlet weak var imageView: UIImageView!
  @IBOutlet weak var nameLabel: UILabel!
  @IBOutlet weak var ratingLabel: UILabel!
  @IBOutlet weak var timesWornLabel: UILabel!
  @IBOutlet weak var lastWornLabel: UILabel!
  @IBOutlet weak var favoriteLabel: UILabel!
  
  var managedContext: NSManagedObjectContext!

  // MARK: - View Life Cycle
  override func viewDidLoad() {
    super.viewDidLoad()
  }

  // MARK: - IBActions
  @IBAction func segmentedControl(_ sender: Any) {

  }

  @IBAction func wear(_ sender: Any) {

  }
  
  @IBAction func rate(_ sender: Any) {

  }
}

Maybe I’m asking the wrong question. Let me try again. When I initially run the app, I see … Okay, I figured out what’s going on. The data I see is some generic data that is set in the storyboard for a bunch of labels.


#5

Hi,
It seems you are opening ViewController.swift from starter folder of chapter 2.
Please open ViewController.swift from the final folder you’ll find all codes.
Cheers NJ


#6

Yes.

Please open ViewController.swift from the final folder you’ll find all codes.

When you run an app and you see something that confuses you, adding more code to the app does not help explain what you were seeing.


#8