Skip to content

Instantly share code, notes, and snippets.

@mishimay
Last active May 7, 2022 02:43
Show Gist options
  • Save mishimay/43597d7560d8d0e44ae76d821d2f2a24 to your computer and use it in GitHub Desktop.
Save mishimay/43597d7560d8d0e44ae76d821d2f2a24 to your computer and use it in GitHub Desktop.
A protocol property in SwiftUI View
import SwiftUI
protocol AppearanceProtocol {
var text: String { get }
}
struct MyView<Appearance: AppearanceProtocol>: View {
let appearance: Appearance
var body: some View {
Text(appearance.text)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment