Post

Replies

Boosts

Views

Activity

Reply to Can’t view Storyboard and swift code on the same screen
Would this be the reason? 2021-03-18 17:54:41.850809+0000 LetsEat2[11993:109147] [Storyboard] Unknown class _TtC8LetsEat222locationViewController in Interface Builder file. 2021-03-18 17:54:41.878913+0000 LetsEat2[11993:109147] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[UIViewController 0x121a05cb0 setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key tableView.' How do I solve the error?
Mar ’21
Reply to Can’t view Storyboard and swift code on the same screen
I don't think you are understanding what I mean! If I have Main.Storyboard and locationViewController open in the tab bar with only the storyboard in the window. I then select the icon to open Assistant, it displays UIViewController.h and not the locationViewController.swift. If I click the LocationViewController in the document outline pane it says no Assistant results, therefore I can't make the connection into the LocationViewController class. I believe if I sort out this connection correctly it may solve the error I get.
Mar ’21
Reply to Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value
Thank you for your reply I did as you explained for the IBOutlets but still did not work, but noticed that the calcBMI fund had a circle by it so I linked it to the button and yes it did work then. At least I learnt something from this post, that the circles on the IBOutlet and IBAction lines indicate that the actions are not linked to the textbook or buttons in the storyboard and if they have a dot in them they do!
Mar ’21
Reply to Can’t view Storyboard and swift code on the same screen
Is this right? When I click on the swift file in the first window (left) and then click on Assistant I get 2 swift files but the one on the right is an incomplete version of the code. The original one says no selection and the one on the right says Interface. Still can't open both storyboard and the Swift file? If I have the storyboard open and click Assistant it says No Assistant Results. If this second copy of the swift file is a error how do I get rid of it? I have searched in finder an can only find one in my project.
Mar ’21
Reply to Cells not correct size in Simulator
I am learning from Ahmed Sahar's book and some of this explainations are not very clear. In the size inspector the Estimate size by default was Automatic, but where he showed the sizes he had changed it to None. I did not spot that first time through, but when I meticulously went through the instructions I noticed that it had been changed.
Apr ’21
Reply to unrecognized selector sent to instance 0x144b071
I have tried all of the above suggestions and I still get the same error. Here is the code after modification: // //  FirstViewController.swift //  CalorieCounter // //  Created by Tony Hudson on 11/04/2021. // import UIKit var userAge: Double? var userWeight: Double? var userGender: String = "Female" class FirstViewController: UIViewController {     override func viewDidLoad() {         super.viewDidLoad()         // Do any additional setup after loading the view.     }     @IBOutlet weak var yourAge: UITextField!     @IBOutlet weak var yourWeight: UITextField!     @IBOutlet weak var segmentedControl: UISegmentedControl!     @IBAction func genderButton(_ sender: UISegmentedControl) {         switch sender.selectedSegmentIndex {         case 0:             userGender = "Female"         case 1:             userGender = "Male"         default:             return         }     }     @IBAction func savePersonalInfo(_ sender: UIButton) {         userWeight = Double(yourWeight.text ?? "0.0") ?? 0.0         userAge = Double(yourAge.text ?? "0.0") ?? 0.0     } } Has anyone got ant other ideas?
Apr ’21
Reply to Missing bracket??
Luckily this is an exercise from a book and the files are available online. I copied the file and pasted it in the project and No errors? Still can't see what caused the error, so if anyone can find why the error occurred please let me know.
Apr ’21
Reply to Assistant not opening the correct swift file
I know how to open the file in IB that is not the problem! By using the method you describe I now open the ExploreViewController.swift, but that is not the file I need to open. In the book it says I need to open the ExploreCell.swift. As I mentioned previously the ExploreCell.swift was created by creating a folder called View, as a sub folder of Explore and then creating a new Cocoa Touch file called ExploreCell.swift. What it is actually doing is opening the top level view controller in the ExploreViewController scene. I hope this makes sense as it is hard to explain. With this information can anyone explain how I can open this Assistant view so that I can create the connection with the label button.
Apr ’21