iPhoneアプリ開発講座(問題③)


//
//  ContentView.swift
//  HelloSwiftUI
//
//  Created by jeff on 2024/04/06.
//

import SwiftUI

struct ContentView: View {
    @State var str = "Hello, SwiftUI"
    var body: some View {
        VStack {
            ZStack{
                Rectangle()
                    .foregroundColor(.yellow)
                    .frame(width:300, height: 300)
                VStack{
                    HStack{
                        Rectangle()
                            .foregroundColor(.black)
                            .frame(width:60, height: 20)
                        ZStack{
                            Rectangle()
                                .foregroundColor(.gray)
                                .frame(width:90, height: 90)
                            Rectangle()
                                .foregroundColor(.white)
                                .frame(width:70, height: 70)
                            Rectangle()
                                .foregroundColor(.black)
                                .frame(width:20, height: 20)
                        }
                        ZStack{
                            Rectangle()
                                .foregroundColor(.gray)
                                .frame(width:90, height: 90)
                            Rectangle()
                                .foregroundColor(.white)
                                .frame(width:70, height: 70)
                            Rectangle()
                                .foregroundColor(.black)
                                .frame(width:20, height: 20)
                        }
                        Rectangle()
                            .foregroundColor(.black)
                            .frame(width:60, height: 20)
                    }
                    ZStack{
                        Rectangle()
                            .foregroundColor(.black)
                            .frame(width:70, height: 40)
                        VStack{
                            Rectangle()
                                .foregroundColor(.white)
                                .frame(width:60, height: 10)
                            Rectangle()
                                .foregroundColor(.red)
                                .frame(width:60, height: 10)
                        }
                    }
                }
            }
            Rectangle()
                .foregroundColor(.blue)
                .frame(width:300, height: 100)
            HStack{
                Rectangle()
                    .foregroundColor(.black)
                    .frame(width:70, height: 30)
                Rectangle()
                    .foregroundColor(.black)
                    .frame(width:70, height: 30)
            }
        }
    }
}

#Preview {
    ContentView()
}

iPhoneアプリ開発講座 by Rikuto Sato

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です