SwiftUIを使って番号付きの箇条書きにしたい!
これをやると下記のようになります。

以下コードです。自分の環境に合わせて置き換えてください。
struct TutorialView: View {
let items = [
"Connect your iPhone to your Mac with a cable.",
"Open QuickTime Player on your Mac.",
"Select File > New Movie Recording.",
"Click the arrow next to the record button and select your iPhone.",
"In the movie recording screen, device information will be displayed in the detailed settings. Click the arrow next to the red recording button and select ‘iPhone’ for the Screen."
]
var body: some View {
Text("How to mirror on Mac using QuickTime Player")
.font(.title)
VStack(alignment: .leading) {
ForEach(items, id: \.self) { item in
HStack(alignment: .top) {
Text("\(items.firstIndex(of: item)! + 1).")
.font(.body)
.fontWeight(.bold)
Text(item)
.font(.body)
}
.padding(.top, 6)
}
}
.padding()
}
}
#Preview {
TutorialView()
}
coiai
この記事もおすすめ
株式会社coiaiは、「想像できることを美しく実現」を掲げ、XR・Web・アプリ・システム開発およびDX支援を行う会社です。 創業2022年、東京都練馬区に本社を置き、要件のヒアリングからPoC(概念実証)、本番運用まで一貫して伴走します。 まずはお気軽にご相談ください。
主なご相談内容
詳しい会社情報は会社概要ページでご覧いただけます。