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
563 changes: 563 additions & 0 deletions 35th-Seminar-SwiftUI/35th-Seminar-SwiftUI.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.

Binary file not shown.
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>
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,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
}
}
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 35th-Seminar-SwiftUI/35th-Seminar-SwiftUI/ContentView.swift
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 이 파일에 다 들어있는 구조가 좀 이상한 것 같아요. 분리해봅시다!

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
Copy link
Member

Choose a reason for hiding this comment

The 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()
}
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
)
]
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)
// }
// }
// }
//}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
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()
}
}
}
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.
}

}
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()
}
}
}
}
Loading