Your Second iOS and SwiftUI App · Section Headers | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5662524-your-second-ios-and-swiftui-app/lessons/27

@jessycatterwaul, what is the difference between implementing closure with type “()->_” like of Section() and “()->()” like of many others?

The underscore is a generic placeholder for a specific type. () is the same thing as Void, so when you write closures with the () -> () type signature, they won’t return anything.

If that doesn’t make enough sense yet, you can learn more about generics in the Advanced Swift course.

1 Like