Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
624 changes: 624 additions & 0 deletions MySwiftUI/MySwiftUI.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "C55339B2-D870-4BD1-9B79-A347A2C8EDCE"
type = "1"
version = "2.0">
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>MySwiftUI.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Binary file added MySwiftUI/MySwiftUI/.DS_Store
Binary file not shown.
33 changes: 33 additions & 0 deletions MySwiftUI/MySwiftUI/5week/MyLabel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// MyLabel.swift
// MySwiftUI
//
// Created by 이지희 on 2022/12/02.
//

import SwiftUI

struct MyLabel: View {
var body: some View {
VStack{
Text("1. Text + Image")
.foregroundColor(.orange)
.padding()
HStack{
Text(Image(systemName: "hand.raised"))
Text("Hello")
}
Divider()
Text("2. Label")
.foregroundColor(.orange)
.padding()
Label("Hello", systemImage: "hand.raised")
}
}
}

struct MyLabel_Previews: PreviewProvider {
static var previews: some View {
MyLabel()
}
}
32 changes: 32 additions & 0 deletions MySwiftUI/MySwiftUI/5week/MyNavigationStack.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// MyNavigationStack.swift
// MySwiftUI
//
// Created by 이지희 on 2022/12/02.
//

import SwiftUI

struct MyNavigationStack: View {
var myName: String = "JH"

var body: some View {
NavigationStack {
NavigationLink(value: myName) {
Text("click")
}.navigationDestination(for: String.self) { value in
ZStack{
Color(.yellow)
Text("Hello \(value)")
}
}
}
}
}


struct MyNavigationStack_Previews: PreviewProvider {
static var previews: some View {
MyNavigationStack()
}
}
48 changes: 48 additions & 0 deletions MySwiftUI/MySwiftUI/5week/MyNavigationView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// MyNavigationView.swift
// MySwiftUI
//
// Created by 이지희 on 2022/12/02.
//

import SwiftUI

struct MyNavigationView: View {
var pinkView: some View{
ZStack{
Color(.systemPink)
Text("pink")
.foregroundColor(.white)
.font(.title)
}
}

var blueView: some View{
ZStack{
Color(.blue)
Text("blue")
.foregroundColor(.white)
.font(.title)
}
}

var body: some View {
NavigationView {
VStack{
NavigationLink(destination: pinkView) {
Text("pinkView로 이동")
}
.padding()
NavigationLink(destination: blueView) {
Text("blueView로 이동")
}
}.navigationTitle("Main")
}
}
}

struct MyNavigationView_Previews: PreviewProvider {
static var previews: some View {
MyNavigationView()
}
}
36 changes: 36 additions & 0 deletions MySwiftUI/MySwiftUI/5week/MyOnAppear.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// MyOnAppear.swift
// MySwiftUI
//
// Created by 이지희 on 2022/12/02.
//

import SwiftUI

struct MyOnAppear: View {
@State var isPresented: Bool = false

var body: some View {
VStack{
Text("Hello")
.onAppear{print("text appear")}
.onDisappear{print("text disappear")}
.sheet(isPresented: $isPresented) {
Color(.yellow)
.onAppear{print("color appear")}
.onDisappear{print("color disappear")}
}
Button {
isPresented.toggle()
} label: {
Text("click!")
}
}
}
}

struct MyOnAppear_Previews: PreviewProvider {
static var previews: some View {
MyOnAppear()
}
}
42 changes: 42 additions & 0 deletions MySwiftUI/MySwiftUI/5week/MyProgressView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// MyProgressView.swift
// MySwiftUI
//
// Created by 이지희 on 2022/12/02.
//

import SwiftUI

struct MyProgressView: View {
@State var progress: Double = 0

var body: some View {
VStack{
Text("1. 로딩 화면")
ProgressView()
Spacer()

Text("2. 로딩 화면 + 텍스트")
ProgressView {
Text("잠시만 기다려주세요")
}
Spacer()

Text("3. 로딩 진행도")
ProgressView("Loaing...", value: progress, total: 100)
Button {
progress += 5
} label: {
Text("Go")
}
}
.padding(40)
.padding([.top, .bottom], 80)
}
}

struct MyProgressView_Previews: PreviewProvider {
static var previews: some View {
MyProgressView()
}
}
73 changes: 73 additions & 0 deletions MySwiftUI/MySwiftUI/5week/MySecondProject.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// MySecondProject.swift
// MySwiftUI
//
// Created by 이지희 on 2022/12/02.
//

import SwiftUI

struct MySecondProject: View {
@State var userId: String = ""
@State var userPassword: String = ""
@State var hasLoggedIn = false
@State var showPassword: Bool = false
@State var showAlert: Bool = false


var body: some View {
VStack{
VStack(alignment: .leading){
Label("ID", systemImage: "person.fill")
TextField("아이디를 입력해주세요", text: $userId)
.autocapitalization(.none)
}
.padding()
VStack(alignment: .leading){
HStack{
Label("Password", systemImage: "lock.fill")
Toggle(isOn: $showPassword){
//label 적는 곳
}
}

if showPassword{
TextField("비밀번호를 입력해주세요", text: $userPassword)
} else {
SecureField("비밀번호를 입력해주세요", text: $userPassword)
}

}
.padding()

Button {
if userPassword == "1234" && userId == "JH" {
hasLoggedIn = true
} else{
hasLoggedIn = false
showAlert = true
}
} label: {
Text("Sign In")
.padding(7)
.padding([.leading, .trailing], 20)
.background(.black)
.cornerRadius(10)
.foregroundColor(.white)
}
}
.padding(30)
.sheet(isPresented: $hasLoggedIn) {
Text("Hello, \(userId)")
}
.alert(isPresented: $showAlert) {
Alert(title: Text("로그인 오류"), message: Text("아이디와 비밀번호를 확인해주세요"))
}
}
}

struct MySecondProject_Previews: PreviewProvider {
static var previews: some View {
MySecondProject()
}
}
40 changes: 40 additions & 0 deletions MySwiftUI/MySwiftUI/5week/MySecureField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// MySecureField.swift
// MySwiftUI
//
// Created by 이지희 on 2022/12/02.
//

import SwiftUI

struct MySecureField: View {
@State var myPassword: String = ""
@State var isSecureMode: Bool = true

var body: some View {
VStack(alignment: .leading){
Text("Password")

HStack{
if isSecureMode{
SecureField("8자리 이상 입력", text: $myPassword)
} else {
TextField("8자리 이상 입력", text: $myPassword)
}
Button {
isSecureMode.toggle()
} label: {
Image(systemName: "eye")
}
}
}
.frame(width: 260)
.padding()
}
}

struct MySecureField_Previews: PreviewProvider {
static var previews: some View {
MySecureField()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions MySwiftUI/MySwiftUI/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading