Created
October 10, 2020 13:40
-
-
Save joogps/574e5d4d829f5669d2a77bf9c922f285 to your computer and use it in GitHub Desktop.
Quick and easy negative text label with colored background in SwiftUI
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 | |
struct TextMask: View { | |
var body: some View { | |
Color.white | |
.frame(maxHeight: 30) | |
.mask(Text("Today") | |
.font(.system(size: 12, weight: .heavy)) | |
.padding(.vertical, 7) | |
.padding(.horizontal, 15) | |
.background(Color.white) | |
.cornerRadius(26) | |
.luminanceToAlpha()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment