Avoid Magic Numbers | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/18176818-your-first-ios-and-swiftui-app-polishing-the-app/lessons/29

When I try to put the Constants.General. CGFloat numbers into the file, I always get an error code saying that these numbers must conform to the ShapeStyle or something like that. I noticed that in Ray’s video he never gets error messages like that. Why?

You can use import SwiftUI instead of import UIkit to avoid errors when using CGFloat.
Is there a reason why we should use UIkit instead of using SwiftUI for a 100% SwiftUI project?

Same question here. By the way, build was broken, until I have made the import of SwiftUI in the Constants file or imported UIKit in the in the Views file… I simply changed the the import of UIKit to SwfitUI in the Constant file but the doubt remains…