Playgrounds and an actual project are different in syntax. Specifically when you're going to a view controller which you are if you're working in contentView. A view uses SwiftUI which is what you see and interact with (an interface) and classes use Swift. The code for these two are not interchangeable which is why you're getting this error. If you have any questions or specific examples of your code that's getting an error just reply to this response.