Hi, I'm new for learning not only Swift but also programming.
I've been following Food Tracker tutorial and faced error today.
First one, this morning, I figured it out with spending an hour and half one google.
The lines tutorial gave me didn't work and the lines I fixed was below
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) {
// The info dictionary may contain multiple representations of the image. You want to use the original.
let selectedImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage
and... now I have another error.
try to add the button to the stack and Xcode said 'error'
The lines are below
private func setupButtons() {
// Create the button
let button = UIButton()
button.backgroundColor = UIColor.red
// Add constraints
button.translatesAutoresizingMaskIntoConstraints = false
button.heightAnchor.constraint(equalToConstant: 44.0).isActive = true
button.widthAnchor.constraint(equalToConstant: 44.0).isActive = true
// Add the button to the stack
addArrangedSubview(button)
}
and error occurs on addArrangedSubview (cannot find 'addArrangedSubview' in scope)
I spent another a couple of hours to fix it and thought that it was a good opportunity to improve my skill by fixing it. But I read lots of comments that TF has lots of bugs and it's old.
Should I finish this tutorial or stop following it?
Please give me advice for the future.
Thank you all.
Selecting any option will automatically load the page