Created
January 23, 2021 02:18
-
-
Save oocoocococo/8c7064661fec02c471f43c408d59c00e 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
import SwiftUI | |
struct ContentView: View { | |
/// カスタムフォントサイズ | |
@ScaledMetric private var fontSize: CGFloat = 30.0 | |
/// カスタム画像サイズ | |
@ScaledMetric private var imageSize: CGFloat = 50.0 | |
/// カスタム余白 | |
@ScaledMetric private var padding: CGFloat = 10.0 | |
/// カスタム角度 | |
@ScaledMetric private var cornerRadius: CGFloat = 3.0 | |
var body: some View { | |
VStack { | |
// ScaledMetric利用 | |
HStack { | |
Image(systemName: "star.fill") | |
.resizable() | |
.frame(width: imageSize , height: imageSize) | |
VStack(alignment: .leading) { | |
Text("サイズ指定あり") | |
.font(.system(size: fontSize)) | |
Text("サイズ指定なし") | |
} // VStack | |
} // HStack | |
.padding(padding) | |
.background(Color.secondary) | |
.cornerRadius(cornerRadius) | |
// 数値指定 | |
HStack { | |
Image(systemName: "star.fill") | |
.resizable() | |
.frame(width:50.0 , height: 50.0) | |
VStack(alignment: .leading) { | |
Text("サイズ指定あり") | |
.font(.system(size: 30.0)) | |
Text("サイズ指定なし") | |
} // VStack | |
} // HStack | |
.padding(10.0) | |
.background(Color.secondary) | |
.cornerRadius(3.0) | |
} // VStack | |
} // body | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment