Guided Project: Apple Pie

Hi, I´m going through the "Develop in swift Fundamentals XCODE 12" course with the Apple Pie project. I'm having a bit of trouble with it. As long as I can see I can't find any errors in my code, so I was hoping any of you could help me out. For the record I'm currently on XCODE 13 Here is my code:

As far as I know I've followed instructions correctly and even watched some videos who do it exactly the same. However when I run the app and click on one of the buttons, this happens:

Can anyone explain to me why this is happening and how can I fix it?

Answered by OOPer in 691081022

how can I fix it?

When you show your code, you should better show the code and the whole error message as text (use the Code Block). With the code being easily testable (copy and paste!), more readers would be involved.

Screen shot is useful as an additional info, but you should better not think it would be a good primary info.


Any way, the most problematic issue is here:

I´m going through the "Develop in swift Fundamentals XCODE 12" course

I'm currently on XCODE 13

Why the heck are you using Xcode 13 for the course written for Xcode 12??????????

Xcode and iOS changes every year, and in some cases it may cause some severe issues when you followed instructions correctly. Especially, iOS 15 introduced some ground up changes in UIButton. You may have noticed some settings views are different than in the course.

If you insist on going on with Xcode 13, you may find other issues in the future.

I recommend you to find a course written for Xcode 13 or get Xcode 12. (See More Downloads pages.)

Accepted Answer

how can I fix it?

When you show your code, you should better show the code and the whole error message as text (use the Code Block). With the code being easily testable (copy and paste!), more readers would be involved.

Screen shot is useful as an additional info, but you should better not think it would be a good primary info.


Any way, the most problematic issue is here:

I´m going through the "Develop in swift Fundamentals XCODE 12" course

I'm currently on XCODE 13

Why the heck are you using Xcode 13 for the course written for Xcode 12??????????

Xcode and iOS changes every year, and in some cases it may cause some severe issues when you followed instructions correctly. Especially, iOS 15 introduced some ground up changes in UIButton. You may have noticed some settings views are different than in the course.

If you insist on going on with Xcode 13, you may find other issues in the future.

I recommend you to find a course written for Xcode 13 or get Xcode 12. (See More Downloads pages.)

So anyone else coming across this... You don't have to download an old version of XCode. Here's a better answer that works with XCode 13.

Instead of:

sender.title(for: normal)!

Change that part to this:

sender.titleLabel!.text!

Replace the line 26 code with this

let letterString = sender.configuration!.title!

That'll do it.

OS 15 update seems to have changed some button behavior. You can use sender.titleLable!.text! instead of sender.title(for: normal)! sender.configuration!.text! also works. Also changing the button style from plain to default may solve the problem. It is better here to use a guard.

Guided Project: Apple Pie
 
 
Q