-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: 6주차 SwiftUI 실습코드 구현 #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HEHEEUN
wants to merge
3
commits into
main
Choose a base branch
from
feature/week6
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
563 changes: 563 additions & 0 deletions
563
35th-Seminar-SwiftUI/35th-Seminar-SwiftUI.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...minar-SwiftUI/35th-Seminar-SwiftUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+33.9 KB
...I.xcodeproj/project.xcworkspace/xcuserdata/hee.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
...h-Seminar-SwiftUI.xcodeproj/xcuserdata/hee.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains hidden or 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,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>35th-Seminar-SwiftUI.xcscheme_^#shared#^_</key> | ||
| <dict> | ||
| <key>orderHint</key> | ||
| <integer>0</integer> | ||
| </dict> | ||
| </dict> | ||
| </dict> | ||
| </plist> |
11 changes: 11 additions & 0 deletions
11
35th-Seminar-SwiftUI/35th-Seminar-SwiftUI/Assets.xcassets/AccentColor.colorset/Contents.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "colors" : [ | ||
| { | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
35 changes: 35 additions & 0 deletions
35
35th-Seminar-SwiftUI/35th-Seminar-SwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains hidden or 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,35 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "idiom" : "universal", | ||
| "platform" : "ios", | ||
| "size" : "1024x1024" | ||
| }, | ||
| { | ||
| "appearances" : [ | ||
| { | ||
| "appearance" : "luminosity", | ||
| "value" : "dark" | ||
| } | ||
| ], | ||
| "idiom" : "universal", | ||
| "platform" : "ios", | ||
| "size" : "1024x1024" | ||
| }, | ||
| { | ||
| "appearances" : [ | ||
| { | ||
| "appearance" : "luminosity", | ||
| "value" : "tinted" | ||
| } | ||
| ], | ||
| "idiom" : "universal", | ||
| "platform" : "ios", | ||
| "size" : "1024x1024" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
6 changes: 6 additions & 0 deletions
6
35th-Seminar-SwiftUI/35th-Seminar-SwiftUI/Assets.xcassets/Contents.json
This file contains hidden or 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,6 @@ | ||
| { | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
112 changes: 112 additions & 0 deletions
112
35th-Seminar-SwiftUI/35th-Seminar-SwiftUI/ContentView.swift
This file contains hidden or 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,112 @@ | ||
| // | ||
| // ContentView.swift | ||
| // 35th-Seminar-SwiftUI | ||
| // | ||
| // Created by 김희은 on 11/23/24. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| struct ChartRow: View { | ||
| let app: AppStoreApplication | ||
|
|
||
| var body: some View { | ||
| // 여기는 부모 뷰! switch넣어서 값 변경하고 싶으면, buttonTitleLabel을 @State private var isButton 로 선언했어야 함 ! ! ! | ||
| // 하위 뷰에서 @Binding var isButton 로 선언하여 하위 뷰에 넘겨줄 수 있다 !! + 하위에서 값을 변경하여야 할 때! @State로 버튼을 선언할 경우, 부모 뷰의 버튼상태와 서로 다른 생명주기?를 갖게 됨. | ||
| //parameter 넘길 때 $사인이 필요 | ||
|
Comment on lines
+14
to
+16
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| HStack { | ||
| app.iconImage | ||
| .resizable() | ||
| .scaledToFit() | ||
| .frame(width: 55, height: 55) | ||
| .overlay( | ||
| RoundedRectangle(cornerRadius: 15) | ||
| .fill(.clear) | ||
| .stroke(.black, lineWidth: 1) | ||
| .frame(width: 60, height: 60) | ||
| ) | ||
| HStack { | ||
| Text(app.ranking.description) | ||
| .font(.headline) | ||
| VStack(alignment: .leading) { | ||
| Text(app.title) | ||
| Text(app.subTitle) | ||
| .font(.caption2) | ||
| } | ||
| } | ||
|
|
||
| Spacer() | ||
|
|
||
| Button {} | ||
| label: { | ||
| Text(app.downloadState) | ||
| .foregroundStyle(.blue) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| struct ContentView: View { | ||
| var body: some View { | ||
| NavigationStack { | ||
| // VStack { | ||
|
|
||
| Text("AppStore") | ||
| .font(.title3) | ||
| .bold() | ||
| .padding(10) | ||
|
|
||
| List { | ||
| Section(header: Text("인기차트") | ||
| .font(.headline) | ||
| .foregroundStyle(.primary) | ||
| .padding(.top)) { | ||
| ForEach(appList) { app in | ||
| ChartRow(app: app) | ||
| } | ||
| } | ||
|
|
||
| Section(header: Text("추천 어플") | ||
| .font(.headline) | ||
| .foregroundStyle(.primary) | ||
| .padding(.top)) { | ||
| ForEach(appList) { app in | ||
| ChartRow(app: app) | ||
| } | ||
| } | ||
| Section(header: Text("") | ||
| .font(.headline) | ||
| .foregroundStyle(.primary) | ||
| .padding(.top)) { | ||
| ForEach(appList) { app in | ||
| ChartRow(app: app) | ||
| } | ||
| } | ||
| } | ||
| .listStyle(.insetGrouped) | ||
| Button { | ||
| //actions | ||
| } | ||
| label: { | ||
| ZStack { | ||
| RoundedRectangle(cornerRadius: 15) | ||
| .frame(height: 70) | ||
| .foregroundStyle(.blue) | ||
| Text("다음") | ||
| .foregroundStyle(.white) | ||
| .backgroundStyle(.blue) | ||
| } | ||
|
|
||
| } | ||
| .shadow(color: Color.black.opacity(0.5), radius: 5, x: 0, y: 5) | ||
| .padding() | ||
| } | ||
| .navigationTitle("App Store") | ||
| .navigationBarTitleDisplayMode(.inline) | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| ContentView() | ||
| } | ||
77 changes: 77 additions & 0 deletions
77
35th-Seminar-SwiftUI/35th-Seminar-SwiftUI/Preview Content/AppStoreApplication.swift
This file contains hidden or 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,77 @@ | ||
| // | ||
| // App.swift | ||
| // 35th-Seminar-SwiftUI | ||
| // | ||
| // Created by 김희은 on 11/23/24. | ||
| // | ||
|
|
||
| import Foundation | ||
| import SwiftUI | ||
|
|
||
| struct AppStoreApplication: Identifiable { | ||
| let id: UUID | ||
| let iconImage: Image | ||
| let ranking: Int | ||
| let title: String | ||
| let subTitle: String | ||
| let downloadState: String | ||
| let category: AppCategory | ||
| } | ||
|
|
||
| enum DownloadState { | ||
| case doDownload | ||
| case downloaded | ||
| case cloudDownload | ||
| } | ||
|
|
||
| enum AppCategory { | ||
| case movie, music, book, game | ||
| } | ||
|
|
||
| let appList: [AppStoreApplication] = [ | ||
| AppStoreApplication( | ||
| id: UUID(), | ||
| iconImage: Image(systemName: "gamecontroller.fill"), | ||
| ranking: 1, | ||
| title: "Super Fun Game", | ||
| subTitle: "Endless fun and adventures await!", | ||
| downloadState: "다시 다운하기", | ||
| category: .game | ||
| ), | ||
| AppStoreApplication( | ||
| id: UUID(), | ||
| iconImage: Image(systemName: "calendar"), | ||
| ranking: 2, | ||
| title: "Daily Planner", | ||
| subTitle: "Organize your tasks efficiently", | ||
| downloadState: "열기", | ||
| category: .movie | ||
| ), | ||
| AppStoreApplication( | ||
| id: UUID(), | ||
| iconImage: Image(systemName: "person.fill"), | ||
| ranking: 3, | ||
| title: "ChatConnect", | ||
| subTitle: "Connect with your friends in a new way", | ||
| downloadState: "열기", | ||
| category: .movie | ||
| ), | ||
| AppStoreApplication( | ||
| id: UUID(), | ||
| iconImage: Image(systemName: "film"), | ||
| ranking: 4, | ||
| title: "StreamX", | ||
| subTitle: "Movies and shows anytime, anywhere", | ||
| downloadState: "다운로드하기", | ||
| category: .game | ||
| ), | ||
| AppStoreApplication( | ||
| id: UUID(), | ||
| iconImage: Image(systemName: "book.fill"), | ||
| ranking: 5, | ||
| title: "LearnSwift", | ||
| subTitle: "Master Swift programming step-by-step", | ||
| downloadState: "다운로드하기", | ||
| category: .book | ||
| ) | ||
| ] |
42 changes: 42 additions & 0 deletions
42
35th-Seminar-SwiftUI/35th-Seminar-SwiftUI/Preview Content/ChartRow.swift
This file contains hidden or 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,42 @@ | ||
| //// | ||
| //// ChartRow.swift | ||
| //// 35th-Seminar-SwiftUI | ||
| //// | ||
| //// Created by 김희은 on 11/23/24. | ||
| //// | ||
| // | ||
| //import SwiftUI | ||
| // | ||
| //struct ChartRow: View { | ||
| // var body: some View { | ||
| // let app: app | ||
| // | ||
| // HStack { | ||
| // Image(systemName: "person") | ||
| // .resizable() | ||
| // .frame(width: 55, height: 55) | ||
| // .overlay( | ||
| // RoundedRectangle(cornerRadius: 15) | ||
| // .fill(.clear) | ||
| // .stroke(.black, lineWidth: 1) | ||
| // .frame(width: 60, height: 60) | ||
| // | ||
| // ) | ||
| // HStack { | ||
| // Text(app.ranking.description) | ||
| // VStack { | ||
| // Text(app.title) | ||
| // Text(app.subTitle) | ||
| // } | ||
| // } | ||
| // | ||
| // Spacer() | ||
| // | ||
| // Button {} | ||
| // label: { | ||
| // Text(app.downloadState.hashValue.description) | ||
| // .foregroundStyle(.blue) | ||
| // } | ||
| // } | ||
| // } | ||
| //} |
6 changes: 6 additions & 0 deletions
6
...eminar-SwiftUI/35th-Seminar-SwiftUI/Preview Content/Preview Assets.xcassets/Contents.json
This file contains hidden or 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,6 @@ | ||
| { | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
35th-Seminar-SwiftUI/35th-Seminar-SwiftUI/_5th_Seminar_SwiftUIApp.swift
This file contains hidden or 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,17 @@ | ||
| // | ||
| // _5th_Seminar_SwiftUIApp.swift | ||
| // 35th-Seminar-SwiftUI | ||
| // | ||
| // Created by 김희은 on 11/23/24. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| @main | ||
| struct _5th_Seminar_SwiftUIApp: App { | ||
| var body: some Scene { | ||
| WindowGroup { | ||
| ContentView() | ||
| } | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
35th-Seminar-SwiftUI/35th-Seminar-SwiftUITests/_5th_Seminar_SwiftUITests.swift
This file contains hidden or 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,17 @@ | ||
| // | ||
| // _5th_Seminar_SwiftUITests.swift | ||
| // 35th-Seminar-SwiftUITests | ||
| // | ||
| // Created by 김희은 on 11/23/24. | ||
| // | ||
|
|
||
| import Testing | ||
| @testable import _5th_Seminar_SwiftUI | ||
|
|
||
| struct _5th_Seminar_SwiftUITests { | ||
|
|
||
| @Test func example() async throws { | ||
| // Write your test here and use APIs like `#expect(...)` to check expected conditions. | ||
| } | ||
|
|
||
| } |
43 changes: 43 additions & 0 deletions
43
35th-Seminar-SwiftUI/35th-Seminar-SwiftUIUITests/_5th_Seminar_SwiftUIUITests.swift
This file contains hidden or 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,43 @@ | ||
| // | ||
| // _5th_Seminar_SwiftUIUITests.swift | ||
| // 35th-Seminar-SwiftUIUITests | ||
| // | ||
| // Created by 김희은 on 11/23/24. | ||
| // | ||
|
|
||
| import XCTest | ||
|
|
||
| final class _5th_Seminar_SwiftUIUITests: XCTestCase { | ||
|
|
||
| override func setUpWithError() throws { | ||
| // Put setup code here. This method is called before the invocation of each test method in the class. | ||
|
|
||
| // In UI tests it is usually best to stop immediately when a failure occurs. | ||
| continueAfterFailure = false | ||
|
|
||
| // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. | ||
| } | ||
|
|
||
| override func tearDownWithError() throws { | ||
| // Put teardown code here. This method is called after the invocation of each test method in the class. | ||
| } | ||
|
|
||
| @MainActor | ||
| func testExample() throws { | ||
| // UI tests must launch the application that they test. | ||
| let app = XCUIApplication() | ||
| app.launch() | ||
|
|
||
| // Use XCTAssert and related functions to verify your tests produce the correct results. | ||
| } | ||
|
|
||
| @MainActor | ||
| func testLaunchPerformance() throws { | ||
| if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { | ||
| // This measures how long it takes to launch your application. | ||
| measure(metrics: [XCTApplicationLaunchMetric()]) { | ||
| XCUIApplication().launch() | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.