Created
August 6, 2020 22:24
-
-
Save oocoocococo/a2f96e9dc88fc22cc5a7d0ac7fd0d418 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
"name" = "Great Dane"; | |
"favoriteButton" = "Favorite"; |
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
"name" = "グレートデーン"; | |
"favoriteButton" = "お気に入り"; |
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 { | |
var body: some View { | |
HStack { | |
Image("Dog001", label: Text("name")) | |
.resizable() | |
.aspectRatio(contentMode: .fit) | |
.frame(height: 80) | |
VStack(alignment: .leading) { | |
Text("name") | |
.font(.headline) | |
.padding(.bottom, 10) | |
HStack { | |
Spacer() | |
Button(action: {}) { | |
Image(systemName: "star.fill") | |
Text("favoriteButton") | |
} // Button | |
.padding() | |
.foregroundColor(Color(UIColor.label)) | |
.background(Color(UIColor.systemBackground)) | |
.cornerRadius(5) | |
} // HStack | |
} // VStack | |
} // HStack | |
.padding() | |
.frame(width: UIScreen.main.bounds.width * 0.8) | |
.background(Color.gray) | |
.cornerRadius(12) | |
.padding() | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ForEach(["en", "ja"], id: \.self) { (identifier) in // 言語: 英語、日本語 | |
ContentView() | |
.environment(\.locale, .init(identifier: identifier)) // 言語の指定 | |
.previewLayout(.sizeThatFits) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment