-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// MyAppear.swift | ||
// Inflearn-SwiftUI-Lv2 | ||
// | ||
// Created by 김민 on 2022/10/29. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct MyAppear: View { | ||
|
||
@State var name: String = "No name" | ||
@State var isPresented: Bool = false | ||
|
||
var body: some View { | ||
|
||
NavigationView { | ||
NavigationLink("Test") { | ||
Text("Sample") | ||
.onAppear { | ||
print("On Appear Sample") | ||
} | ||
.onDisappear { | ||
print("On Disappear Sample") | ||
} | ||
} | ||
} | ||
.onAppear { | ||
print("On Appear") | ||
} | ||
.onDisappear { | ||
print("On Disappear") | ||
} | ||
|
||
// VStack { | ||
// Text(name) | ||
// .onAppear { | ||
// print("On Appear") | ||
// } | ||
// .onDisappear { | ||
// print("On Disappear") | ||
// } | ||
// .sheet(isPresented: $isPresented) { | ||
// Text("Modal") | ||
// } | ||
// | ||
// Button { | ||
// isPresented.toggle() | ||
// } label: { | ||
// Text("Change") | ||
// .onAppear { | ||
// print("On Appear Modal") | ||
// } | ||
// .onDisappear { | ||
// print("On Disappear Modal") | ||
// } | ||
// } | ||
// | ||
// } | ||
} | ||
} | ||
|
||
struct MyAppear_Previews: PreviewProvider { | ||
static var previews: some View { | ||
MyAppear() | ||
} | ||
} |