Skip to content
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

Feat [#5] App Picker SwiftUI button 구현 #12

Merged
merged 4 commits into from
Jan 4, 2024
Merged

Conversation

Zoe0929
Copy link
Member

@Zoe0929 Zoe0929 commented Jan 4, 2024

👾 작업 내용

SwiftUI를 이용해서 구현해야하는 App Picker 버튼을 구현했습니다.

🚀 PR Point

  • SwiftUI 코드는 Code Convention이 따로 없어서 최대한 깔끔하게 적어보려 노력했습니다.
  • 사용시에는 다음과 같이 HostingViewController를 사용해주시면 됩니다.
    var hostingController: UIHostingController<HMHAppSelectButtonView>?
    
    private lazy var contentViewController : UIHostingController<some View> = {
        let model = BlockingApplicationModel.shared
        let hostingController = UIHostingController(
            rootView: HMHAppSelectButtonView()
                .environmentObject(model)
        )
        return hostingController
    }()
  • 이 경우에는 ViewController로 선언되기 때문에 contentViewController.view 형식으로 사용해야합니다. 이 부분 더 좋은 코드 있을지 더 고민해보겠습니다.
  • SwiftUI의 View를 UIkit에서 사용하는 과정에서, AutoLayout을 잡으면, SwiftUI의 ContentsView가 하나의 뷰로 간주되어, 터치 영역이 텍스트 부분에만 잡히게 되었습니다. 이 문제를 해결하기 위해 RoundedRect 뷰를 아래에 두고, 그 위에 Button 크기가를 고정해두어 터치 영역을 잡아뒀습니다.
image

📸 스크린샷

구현 내용 스크린샷
앱 선택 버튼 Simulator Screen Recording - iPhone 15 Pro - 2024-01-04 at 21 43 58

✅ Issue

Resolved #5

@Zoe0929 Zoe0929 added 🐰지희 지희의 issue 🌈 feat 기능 구현 labels Jan 4, 2024
@Zoe0929 Zoe0929 added this to the 🚀1차 스프린트🚀 milestone Jan 4, 2024
@Zoe0929 Zoe0929 self-assigned this Jan 4, 2024
Copy link
Member

@kim-seonwoo kim-seonwoo left a comment

Choose a reason for hiding this comment

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

구현 수고 많으셨습니다~👍👏🏽🍀

.frame(width: 336, height: 52)
.background(Color(uiColor: .bluePurpleButton))
}
.familyActivityPicker(isPresented: $isPresented, selection: $model.newSelection)
Copy link
Member

Choose a reason for hiding this comment

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

오 이 부분이 앱을 불러오는 건가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

맞습니다~ picker뷰를 띄워서 model에 저장하는 부분입니다!

Copy link
Contributor

@boyeon0119 boyeon0119 left a comment

Choose a reason for hiding this comment

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

p5. SwiftUI 처음이실텐데 진짜 고생하셨습니다!!!!

// Created by 지희의 MAC on 1/4/24.
//

import Foundation
Copy link
Contributor

Choose a reason for hiding this comment

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

p5.이 친구는 왜 혼자 쓸쓸하게 있는걸까요??

Copy link
Member Author

Choose a reason for hiding this comment

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

추후에 사용될 파일입니다!


var body: some View {
ZStack {
Color(uiColor: .clear)
Copy link
Contributor

Choose a reason for hiding this comment

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

p5.스유에서는 UIColor가 아니라 uiColor라고 쓰나요?!?

Copy link
Member Author

Choose a reason for hiding this comment

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

넵 여기서는 UIColor 대신 Color를 사용합니다! Color의 내장함수입니다~

@Zoe0929 Zoe0929 merged commit a98ad19 into develop Jan 4, 2024
@Zoe0929 Zoe0929 deleted the feat/#5-onboarding branch January 9, 2024 02:45
@boyeon0119 boyeon0119 changed the title Fea [/#5] App Picker SwiftUI button 구현 Feat [#5] App Picker SwiftUI button 구현 Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌈 feat 기능 구현 🐰지희 지희의 issue
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feat] 온보딩 스크린타임 버튼
3 participants