-
Notifications
You must be signed in to change notification settings - Fork 4
[Feat] JsonParsing #22
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
Conversation
diff --git a/AsyncSwift/Observed/EventDetailView+Observed.swift b/AsyncSwift/Observed/EventDetailView+Observed.swift
index cf01070..a91b44c 100644
--- a/AsyncSwift/Observed/EventDetailView+Observed.swift
+++ b/AsyncSwift/Observed/EventDetailView+Observed.swift
@@ -11,7 +11,11 @@ import EventKit
extension EventDetailView {
final class Observed: ObservableObject {
- @Published var event = Event()
+ init(event: Event) {
+ self.event = event
+ }
+
+ @Published var event: Event
@Published var isShowingSheet = false
@Published var isShowingAddEventConfirmationAlert = false
@Published var isShowingAddEventSuccessAlert = false
diff --git a/AsyncSwift/Views/EventDetailView.swift b/AsyncSwift/Views/EventDetailView.swift
index 4cb63d1..3bc215d 100644
--- a/AsyncSwift/Views/EventDetailView.swift
+++ b/AsyncSwift/Views/EventDetailView.swift
@@ -9,10 +9,10 @@ import SwiftUI
struct EventDetailView: View {
- @StateObject var observed = Observed()
+ @ObservedObject var observed: Observed
init(event: Event) {
-// self.observed.event = event
+ self.observed = Observed(event: event)
}
var body: some View { |
예정된 행사, 진행중인 행사, 지나간 행사를 계산하고 화면을 그려주는 기능
- struct Event 의 type: String 이라는 property 추가
- sessionDetail 을 Hstack에 넣어 좌측으로 밀었습니더
- Padding, Stack 등을 수정 디자인이 미흡하게 반영된 허점을 수정하였습니다
| .font(.title3) | ||
| .fontWeight(.semibold) | ||
| .padding(.vertical, 24) | ||
| VStack(alignment: .leading, spacing: 8) { |
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.
| VStack(alignment: .leading, spacing: 8) { | |
| VStack(alignment: .leading) { |
8이 default value였던 것 같아서 생략 가능할까요 ?
- Struct 구조 수정 - EventView+Observed 내부 변수 수정
- Portraint Mode Only - Light Mode Only
- 최최최최최최초ㅣ종
unnnyong
left a comment
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.
🙏
|
|
||
| import Foundation | ||
|
|
||
| struct Event: Codable { |
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.
IMO로 get만 할 때는 Decodable도 되지 않을까 싶네요
| guard let self = self else { return } | ||
| do { | ||
| let decodedData = try JSONDecoder().decode(Event.self, from: data) | ||
| withAnimation { |
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.
이게 트리거로 멋진 애니메이션이 나오는거였군요 👾
unnnyong
left a comment
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.
お疲れ様でした! 🍵 🍵 🍵 🍵
json fetch 후 view에 data를 전달하는 구조로 refactoring 하였습니다
struct 를 codable 로 수정하였고 요청에 의해 구조가 수정되었습니다