Skip to content

Instantly share code, notes, and snippets.

@backslash-f
Created July 28, 2020 20:49
Show Gist options
  • Save backslash-f/7cb3d4892ab69c210aea75dd7a23a0fb to your computer and use it in GitHub Desktop.
Save backslash-f/7cb3d4892ab69c210aea75dd7a23a0fb to your computer and use it in GitHub Desktop.
Add "print" capabilities to SwiftUI Views
import SwiftUI
extension View {
/// Source: https://stackoverflow.com/a/59473712/584548
func log(_ vars: Any...) -> some View {
vars.forEach { print("\($0)") }
return EmptyView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment