Last active
May 7, 2022 02:43
-
-
Save mishimay/43597d7560d8d0e44ae76d821d2f2a24 to your computer and use it in GitHub Desktop.
A protocol property in SwiftUI View
This file contains hidden or 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 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