Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created December 22, 2020 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sturdysturge/04cc0d7ababa0c9977e87b551a23fbe8 to your computer and use it in GitHub Desktop.
Save sturdysturge/04cc0d7ababa0c9977e87b551a23fbe8 to your computer and use it in GitHub Desktop.
SwiftUIProtocolsAndExtensions
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