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?

Accepted Reply

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.)

  • Thanks for the info. Guess my best option is to get XCODE 12 to finish the course. I barely started learning how to code a month ago and I'm still getting the hang on how both the language and IDE work, this is also my very first post on here so I'm not that familiar with the rules or practices that are usually accepted.

  • Apple prefers innovation rather than compatibility, that might show some bad aspects for beginners. But Apple has the dev forums. If you find difficulties developing on the Apple's platforms and tools, you will get answers here. Hope you will make great apps. Good luck.

  • As an instructor, I'll tell you why the heck the user is using Xcode 13. Apple has not updated the text correctly to include the new syntax, and the Apple Pie 12 project was included in the Apple Pie 13 text, creating problems for everyone! We are just grateful for folks like willgucsb who answered the question rather than scolding the questioner.

Add a Comment

Replies

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.)

  • Thanks for the info. Guess my best option is to get XCODE 12 to finish the course. I barely started learning how to code a month ago and I'm still getting the hang on how both the language and IDE work, this is also my very first post on here so I'm not that familiar with the rules or practices that are usually accepted.

  • Apple prefers innovation rather than compatibility, that might show some bad aspects for beginners. But Apple has the dev forums. If you find difficulties developing on the Apple's platforms and tools, you will get answers here. Hope you will make great apps. Good luck.

  • As an instructor, I'll tell you why the heck the user is using Xcode 13. Apple has not updated the text correctly to include the new syntax, and the Apple Pie 12 project was included in the Apple Pie 13 text, creating problems for everyone! We are just grateful for folks like willgucsb who answered the question rather than scolding the questioner.

Add a Comment

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!

  • this works! thank you!

  • Thanks, everything works fine now.

Add a Comment

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.