-contentview-
//
// ContentView.swift
// Swift_stack_practice_tutorial
//
// Created by devdepot on 2021/04/27.
//
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack(alignment: .bottomTrailing){
VStack(alignment:.leading){
HStack{
Image(systemName: "line.horizontal.3")
.font(.largeTitle)
Spacer()
Image(systemName: "person.crop.circle.fill")
.font(.largeTitle)
}.padding(.horizontal,20)
Text("이일팔 할 일 목록")
.fontWeight(.bold)
.font(.system(size: 30))
ScrollView{
VStack{
MyProjectCard()
MyBasicCard()
MyCard(icon: "doc.fill", title: "책읽기", start: "오전 9시", end: "오후 3시", bgColor: Color.green)
MyCard(icon: "tray.fill", title: "책읽기", start: "오전 9시", end: "오후 3시", bgColor: Color.green)
MyCard(icon: "doc.fill", title: "책읽기", start: "오전 9시", end: "오후 3시", bgColor: Color.green)
MyCard(icon: "doc.fill", title: "책읽기", start: "오전 9시", end: "오후 3시", bgColor: Color.green)
MyCard(icon: "doc.fill", title: "책읽기", start: "오전 9시", end: "오후 3시", bgColor: Color.green)
}
// .padding()
}
}.padding(.top,20)
.padding(.horizontal,20)
Circle()
.frame(width: 50, height: 50,alignment: .center)
.foregroundColor(.yellow)
.overlay(Image(systemName: "plus")
.font(.system(size: 30))
.foregroundColor(.white))
.padding(.trailing,10)
.shadow(radius: 20)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
-MyProjectCard-
//
// MyProjectCard.swift
// Swift_stack_practice_tutorial
//
// Created by devdepot on 2021/04/27.
//
import SwiftUI
struct MyProjectCard : View{
@State var shouldShowAlert: Bool = false
var body: some View{
VStack(alignment: .leading){
Rectangle().frame(height:0)
Text("이일팔 프로젝트")
.font(.system(size: 23))
.fontWeight(.black)
.padding(.bottom,5)
Text("10 AM - 11 AM")
.foregroundColor(.secondary)
.padding(.bottom,10)
// Divider()
HStack{
Image("1")
.resizable()
.frame(width: 50, height: 50)
.clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
.overlay(Circle()
.stroke(lineWidth: 5)
.foregroundColor(Color.orange))
Image("2")
.resizable()
.frame(width: 50,height:50)
Image("3")
.resizable()
.frame(width: 50,height:50)
Spacer()
//
Button(action: {
print("버튼 클릭")
self.shouldShowAlert = true
}
){
Text("확인")
.fontWeight(.bold)
.foregroundColor(.white)
.padding()
.background(Color.blue)
.cornerRadius(20)
.frame(width:80)
}.alert(isPresented: $shouldShowAlert){
Alert(title: Text("알림창입니다!"))
}
}
}
.padding(30)
.background(Color.yellow)
.cornerRadius(20)
}
}
-MyBasicCard-
//
// MyBasicCard.swift
// Swift_stack_practice_tutorial
//
// Created by devdepot on 2021/04/27.
//
import SwiftUI
struct MyBasicCard : View{
var body: some View{
HStack(spacing:20){
Image(systemName: "flame.fill")
.font(.system(size: 40))
.foregroundColor(.white)
// .frame(width:100,height: 100)
VStack(alignment: .leading){
Rectangle().frame(height:0)
Text("하하하")
.fontWeight(.bold)
.font(.system(size: 25))
.foregroundColor(.white)
Spacer().frame(height:5)
Text("하하하")
.foregroundColor(.white)
}
}
.padding(20)
.background(Color.purple)
.cornerRadius(20)
}
}
-MyCard(동적)-
//
// MyBasicCard.swift
// Swift_stack_practice_tutorial
//
// Created by devdepot on 2021/04/27.
//
import SwiftUI
struct MyCard : View{
var icon : String
var title : String
var start : String
var end : String
var bgColor : Color
var body: some View{
HStack(spacing:20){
Image(systemName: icon)
.font(.system(size: 40))
.foregroundColor(.white)
// .frame(width:100,height: 100)
VStack(alignment: .leading){
Rectangle().frame(height:0)
Text(title)
.fontWeight(.bold)
.font(.system(size: 25))
.foregroundColor(.white)
Spacer().frame(height:5)
Text("\(start) ~ \(end)")
.foregroundColor(.white)
}
}
.padding(20)
.background(bgColor)
.cornerRadius(20)
}
}
struct MyCard_Previews: PreviewProvider {
static var previews: some View {
MyCard(icon: "doc.fill", title: "책읽기", start: "오전 9시", end: "오후 3시", bgColor: Color.green)
}
}
'IOS > SwiftUI' 카테고리의 다른 글
(SwiftUI)10.GeometryReader,enum,애니메이션 (0) | 2021.04.28 |
---|---|
(SwiftUI)09.리스트뷰 (0) | 2021.04.27 |
(SwiftUI)07.Stack 정리 (0) | 2021.04.27 |
(SwiftUI)06.CircleImage (0) | 2021.04.27 |
(SwiftUI)04.웹뷰 띄우기 (0) | 2021.04.27 |