Group Group Group Group Group Group Group Group Group

Your First iOS and SwiftUI App: An App From Scratch | raywenderlich.com

Updated for 2020! If you're a complete beginner to iOS and SwiftUI development and wondering how to get started, this is the course for you.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/17493408-your-first-ios-and-swiftui-app-an-app-from-scratch

I am having an issue at Extracting Views in the Polishing the App section. Specifically, I am having trouble with the Bullseye app: I am getting a Cannot find ‘SliderLabelText’ in scope error in my ContentView.swift file which is GitHub - pmdenlinger/Bullseye: SwiftUI version using Xcode 12.5 in the latest commit. The errors are on lines 48 and 50. I have looked over and over in the ContentView and TextViews file and can’t find what’s wrong.

Hi @pdenlinger! In Xcode 12.5 the compiler no longer automatically converts Int to CGFloat like it did before. To fix this, modify the line where you create InstructionsView in ContentView.swift as follows:

InstructionsView(game: $game)
  .padding(.bottom, alertIsVisible ? CGFloat(0) : CGFloat(100))

Notice instead of simply 0 or 100 it’s now CGFloat(0) and CGFloat(100). That manually converts the Ints to CGFloats.

I hope this helps and that you are enjoying the course! :]

Thank you; why did they make this change to the compiler. Did they want to make the typecasting more explicit.
Your course is excellent. I like that your video courses and books go very well together; I am now working on closures, enumerations and protocols, and the Swift Apprentice book helps in my getting a deeper understanding of these important features. Great job!

@pdenlinger I’m not really sure why they made this change! If anyone else knows, feel free to chime in :]

Thanks so much for your kind words about the course! I’m glad you’re enjoying the Swift Apprentice too, and that’s great that you’re making use of both the books and the video courses, that’s why we create both! :]