Update TextRibbon.swift (#65)

* Update TextRibbon.swift

* Add back rotation effect

* Added comment for future reference

* Fixed typo

* Fix text selection on TextRibbon
This commit is contained in:
Nindi Gill 2023-06-24 23:15:44 +10:00 committed by GitHub
parent f215031df1
commit e3a6d930d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -10,15 +10,16 @@ import SwiftUI
struct TextRibbon: View {
var title: String
var length: CGFloat
private let degrees: CGFloat = -45
private let degrees: CGFloat = -45.001
// app crashes when value is exactly -45 ¯\_()_/¯
var body: some View {
Text(title)
.foregroundColor(.white)
.frame(width: length)
.background(Color.accentColor)
.rotationEffect(.degrees(degrees))
.mask(Circle().frame(width: length, height: length))
.rotationEffect(.degrees(degrees))
}
}

View file

@ -24,6 +24,7 @@ struct ListRowDetail: View {
ScaledImage(name: imageName, length: length)
if beta {
TextRibbon(title: "BETA", length: length * 0.9)
.textSelection(.disabled)
}
}
HStack(spacing: spacing) {