Last active
March 4, 2020 17:57
-
-
Save mattyoung/5ac4f7307812ddd501d5bf599f023794 to your computer and use it in GitHub Desktop.
This file contains 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
// WARNING: this only works in Xcode 11.4 beta 2 | |
// .minimumScaleFactor() is broken before and after | |
import SwiftUI | |
struct BigText: View { | |
private static let fontSize: CGFloat = 120 | |
@State private var margin: CGFloat = 0 | |
var body: some View { | |
VStack { | |
HStack(alignment: .top) { | |
Color.green | |
.frame(width: 90 + self.margin) | |
VStack(alignment: .leading) { | |
Text("4℃") | |
.lineLimit(1) | |
.font(.system(size: Self.fontSize, weight: .thin, design: .rounded)) | |
Text("19010℃") | |
.lineLimit(1) | |
.font(.system(size: Self.fontSize, weight: .thin, design: .rounded)) | |
Text("90℃") | |
.lineLimit(1) | |
.font(.system(size: Self.fontSize, weight: .thin, design: .rounded)) | |
} | |
.minimumScaleFactor(0.3) | |
Color.purple | |
.frame(width: 70 + self.margin) | |
} | |
Spacer() | |
Slider(value: self.$margin, in: 0...130) | |
} | |
} | |
} | |
struct BigText_Previews: PreviewProvider { | |
static var previews: some View { | |
BigText() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment