-
-
Save sturdysturge/4ee9eadeb0c8f9b37e8a80dcd9de5eb9 to your computer and use it in GitHub Desktop.
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 | |
#if hasAttribute(dynamicMemberLookup) | |
@dynamicMemberLookup | |
struct Print { | |
static subscript(dynamicMember member: String) -> String { | |
print(member) | |
return member | |
} | |
} | |
struct ContentView: View { | |
@State var input = "" | |
@State var output = "" | |
var body: some View { | |
Form { | |
Button("Print") { | |
output = Print.helloWorld | |
} | |
Text(output) | |
} | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment