본문 바로가기
💻 Development/SwiftUI

[SwiftUI] 0927 우당탕탕 Scrumdinger 만들기 - Extract the meeting header~

by Claudia 끌라우 2023. 9. 27.
반응형

* 공부했던 내용을 주관적으로 해석하여 '제가' 이해하기 쉽도록 작성하였습니다. 잘못된 정보가 있을 시 알려주시면 제게 큰 힘이 됩니다!


https://developer.apple.com/tutorials/app-dev-training/managing-state-and-life-cycle#Extract-the-meeting-header

 

Managing state and life cycle | Apple Developer Documentation

Scrumdinger keeps you informed as your scrum changes. To build this key feature in the app, you’ll use life cycle methods to control a model that manages the scrum state.

developer.apple.com

 

기존의 Scrumdinger의 MeetingView에서 Header를 분리해서 컴포넌트화 하는 작업을 진행함

 


guard 문 사용

- 조건문을 걸러낼때 사용하는 구문

https://velog.io/@youngking0914/iOSSwift-guard-%EB%AC%B8

 

[iOS][Swift] guard 문

Swift guard 구문에 대한 설명입니다 !

velog.io


Voice Over

VoiceOver 사용자는 진행률 보기 또는 진행률 링을 설명할 참조글이 없으며, 

초에서 분으로의 변환을 계산하고 가장 관련성이 높은 데이터(남은 분)를 표시해야한다.

- VoiceOver에서 표현이 가능한 범위와 그렇지 못한 범위에 대한 관심이 필요해보인다


< Section 3 Add design elements to the meeting header >

- meeting header 프로그레스바에 디자인 디테일을 더해주는 과정


< Section 4 Add a state object for a source of truth >

- 이 튜토리얼 과정에서는 Class가 포함된 파일을 직접 타이핑 하는 과정은 없고, 예제 파일을 통해 이해하는 과정이 있다.

 

이전 작업 중, @State를 사용하여 벨류타입 모델에 대한 SOT을 만들었다.

@StateObject를 사용하여 ObservableObject 프로토콜을 준수하는 레퍼런스 타입 모델에 대한 SOT를 만들 수 있다.

(스타터 프로젝트에는 ObservableObject를 준수하는 모델인 ScrumTimer 클래스가 포함되어 있습니다. @StateObject를 사용하여 회의 보기에서 이 클래스의 인스턴스를 선언할 것입니다.)

 

ScrumTimer 수업은 주기적으로 회의 상태를 업데이트 한다.

타이머는 Speaker가 변경되고 @Published 속성을 통해 다른 중요한 상태 변경 사항을 공유할 때 speakerChangedAction 클로저를 호출합니다.

 

9/26-> Observable object가 상태가 변화한다고 알리면 그에 따라서 관찰자들이 행동하는것 처럼!

https://designer-clau.tistory.com/19

 


< Section 5 Add life cycle events >

- SwiftUI는 뷰가 나타나고 사라질 때(변화할 때) 이벤트 트리거(상태 변동을 위한)를 위한 라이프사이클 이벤트를 제공한다.

- MeetingView에 OnAppear과 DisAppear 추가하기


< Section 6 Extract the meeting footer >

- Meeting Footer을 위한 뷰를 새로 만들고 Footer를 컴포넌트화 한다.

- 이 과정을 통해 Speaker를 스킵할 수 있는 기능을 만든다.

 

Void

- 함수 또는 메서드를 선언할 때 값이 반환되지 않으면 반환 유형을 지정할 필요가 없다.
그러나 함수, 메서드 또는 클로저의 유형에는 항상 반환 유형이 포함되며, 지정되지 않으면 Void입니다.
값을 반환하지 않는 폐쇄, 함수 또는 메서드를 선언할 때 Void 또는 빈 튜플을 반환 유형으로 사용합니다. (파파고 번역)

- https://cocoacasts.com/what-is-void-in-swift

 

What Is Void in Swift

In the previous episodes of this series, we explored AnyObject and Any. Another keyword you encounter frequently in Swift is Void. What is Void? That is the focus of this installment of What The Swift.

cocoacasts.com


ScrumTimer는 시간이 끝났을 때 각 Speaker를 완료된 것으로 표시한다.

완료된 것으로 표시되지 않은 첫 번째 Speaker는 활성화된 Speaker가 된다.

speakerNumber 속성은 인덱스를 사용하여 바닥글 텍스트의 일부로 사용할 활성 Speaker 번호를 반환한다(?)


아니 근데 나만 ScrumProgressViewStyle 이거 안보임? 아니 어떻게 만드는건데;;

 

import SwiftUI

struct ScrumProgressViewStyle: ProgressViewStyle {
    var theme: Theme

    func makeBody(configuration: Configuration) -> some View {  //configuration : 배열
  
        ZStack {
            RoundedRectangle(cornerRadius: 10.0)
                .fill(theme.accentColor)
                .frame(height: 20.0)
            if #available(iOS 15.0, *) {
                ProgressView(configuration)
                    .tint(theme.mainColor)
                    .frame(height: 12.0)
                    .padding(.horizontal)
            } else {
                ProgressView(configuration)
                    .frame(height: 12.0)
                    .padding(.horizontal)
            }
        }
    }
}

struct ScrumProgressViewStyle_Previews: PreviewProvider {
    static var previews: some View {
        ProgressView(value: 0.4)
            .progressViewStyle(ScrumProgressViewStyle(theme: .buttercup))
            .previewLayout(.sizeThatFits)
    }
}

https://designer-clau.tistory.com/13

 

[SwiftUI] 0913 우당탕탕 Scrumdinger 만들기 - Configuration과 Extension

* 공부했던 내용을 주관적으로 해석하여 '제가' 이해하기 쉽도록 작성하였습니다. 잘못된 정보가 있을 시 알려주시면 제게 큰 힘이 됩니다! 헷갈리니까 한 번 더 정리... 인스턴스 (instance) - Swift

designer-clau.tistory.com

 

반응형

댓글