Created
July 28, 2020 20:49
-
-
Save backslash-f/7cb3d4892ab69c210aea75dd7a23a0fb to your computer and use it in GitHub Desktop.
Add "print" capabilities to SwiftUI Views
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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