Created
December 22, 2020 12:08
-
-
Save sturdysturge/04cc0d7ababa0c9977e87b551a23fbe8 to your computer and use it in GitHub Desktop.
SwiftUIProtocolsAndExtensions
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 | |
protocol TextDisplayable: View { | |
var text: String { get } | |
} | |
struct TextView: TextDisplayable { | |
let text: String | |
} | |
extension TextView { | |
var body: some View { | |
Text(text) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment