From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

@Binding in public

@Binding in public

- [Instructor] SwiftUI and Swift Playgrounds are now playing together, but sometimes you might run into problems. One of those has to do with the @binding variables in Playground modules, but extends to any time you make a public struct with @binding. If you open up the exercise files, you'll find a playground with two modules. One is RowView, which contains the code for a row of data, the equivalent of a UITableViewCell. The other is ListView, a list. I have to put this list in a module. There's a bug in Playgrounds which I discuss in my course, "Swift Playgrounds Application Development," that you cannot have a list in an Xcode playground, but it will work if you pre-compile it in a module. So I need this in a module, which means it's public. In the main playground, I have an error. This is something you have to deal with with public structs. You cannot have an implicit initializer, it must be explicit to be public.…

Contents