2023年6月12日
- ターミナルを起動する
- ターミナルで
mkdir ~/Documents/iOSPractice
と入力して新しいフォルダを作成する - 上記を実行後、ターミナルに
cd ~/Documents/iOSPractice
と入力してディレクトリを移動する - ディレクトリを移動したら、ターミナルに
git clone https://github.com/MaskerDog/Practice001.git
と入力して、リポジトリをローカルにクローンする(自分のPCにダウンロードするようなもの) - クローンができたら
open Practice001/Practice001.xcodeproj/
と入力してXcodeでプロジェクトを開く - Xcodeからシミュレーターを起動する
- 次の画像が表示されることを確認する
- Xcodeに慣れる
- 入力を恐れない
まず模写をする。
ContentViewを次のように修正をする。
struct ContentView: View {
var body: some View {
VStack {
Text("Good")
Image(systemName: "sun.max.fill")
Text("Morning")
}
}
}
VStackをHStackに変えて変化を見る。
書く前に、「どうなるか?」をイメージしてから変えること。
- VStackは部品を上から下に並べてくれる
- HStackは部品を左から右に並べてくれる
Image(systemName: "sun.max.fill")
.foregroundColor(Color.blue)
でできる。
画像の色変更ができたので、違う色に変えてみる。
やること3で青くした画像の色を別の色に変えてみる。
Color.
まで打つと候補が出てくるので、自由な色を選択する。
Text("Morning")
の次の行に好きなSymbolsを加える。
まず、Text("Morning")
の末尾で改行をする。