Skip to content
Merged
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
81 changes: 42 additions & 39 deletions Projects/App/Sources/MainTab/MainTabFeatureView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -272,50 +272,53 @@ private extension MainTabView {
var action: (TabAddSheetType) -> Void

var body: some View {
HStack(spacing: 20) {
Spacer()

ForEach(TabAddSheetType.allCases, id: \.self) { type in
Button(action: { action(type) }) {
VStack(spacing: 4) {
Spacer()

type.icon
.renderingMode(.template)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 28, height: 28)
.foregroundStyle(.pokit(.icon(.inverseWh)))

Text(type.title)
.pokitFont(.b3(.m))
.foregroundStyle(.pokit(.text(.inverseWh)))

Spacer()
}
.padding(.horizontal, 24)
.background {
RoundedRectangle(cornerRadius: 12, style: .continuous)
.foregroundStyle(.pokit(.bg(.brand)))
GeometryReader { proxy in
let bottomSafeArea = proxy.safeAreaInsets.bottom
HStack(spacing: 20) {
Spacer()

ForEach(TabAddSheetType.allCases, id: \.self) { type in
Button(action: { action(type) }) {
VStack(spacing: 4) {
Spacer()

type.icon
.renderingMode(.template)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 28, height: 28)
.foregroundStyle(.pokit(.icon(.inverseWh)))

Text(type.title)
.pokitFont(.b3(.m))
.foregroundStyle(.pokit(.text(.inverseWh)))

Spacer()
}
.padding(.horizontal, 24)
.background {
RoundedRectangle(cornerRadius: 12, style: .continuous)
.foregroundStyle(.pokit(.bg(.brand)))
}
.frame(height: 96)
}
.frame(height: 96)
}

Spacer()
}

Spacer()
}
.padding(.top, 36)
.padding(.bottom, 48)
.pokitPresentationCornerRadius()
.pokitPresentationBackground()
.presentationDragIndicator(.visible)
.readHeight()
.onPreferenceChange(HeightPreferenceKey.self) { height in
if let height {
self.height = height
.padding(.bottom, 48 - bottomSafeArea)
.padding(.top, 36)
.pokitPresentationCornerRadius()
.pokitPresentationBackground()
.presentationDragIndicator(.visible)
.readHeight()
.onPreferenceChange(HeightPreferenceKey.self) { height in
if let height {
self.height = height
}
}
.presentationDetents([.height(self.height)])
}
.presentationDetents([.height(self.height)])
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// KeyboardClient+LiveKey.swift
// CoreKit
//
// Created by 김민호 on 3/31/25.
//

import UIKit
import Combine
import Dependencies

extension KeyboardClient: DependencyKey {
public static let liveValue: Self = {
.init(
isVisible: {
AsyncStream { continuation in
let notificationCenter = NotificationCenter.default

let showObserver = notificationCenter
.publisher(for: UIResponder.keyboardWillShowNotification)
.map { _ in true }

let hideObserver = notificationCenter
.publisher(for: UIResponder.keyboardWillHideNotification)
.map { _ in false }

let cancellable = Publishers.Merge(showObserver, hideObserver)
.removeDuplicates()
.sink { isVisible in
continuation.yield(isVisible)
}

continuation.onTermination = { _ in cancellable.cancel() }
}
}
)
}()
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// KeyboardClient+TestKey.swift
// CoreKit
//
// Created by 김민호 on 3/31/25.
//

import Foundation

import Dependencies

extension KeyboardClient: TestDependencyKey {
public static let previewValue = Self.noop
}

extension KeyboardClient {
public static let noop = Self(
isVisible: { .finished }
)
}
15 changes: 15 additions & 0 deletions Projects/CoreKit/Sources/Data/Client/Keyboard/KeyboardClient.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// KeyboardClient.swift
// CoreKit
//
// Created by 김민호 on 3/31/25.
//

import Foundation

import DependenciesMacros

@DependencyClient
public struct KeyboardClient: Sendable {
public var isVisible: @Sendable () async -> AsyncStream<Bool> = { .finished }
}
86 changes: 45 additions & 41 deletions Projects/DSKit/Sources/Components/PokitAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,54 +31,58 @@ public struct PokitAlert: View {
}

public var body: some View {
VStack(spacing: 0) {
VStack(spacing: 8) {
title
GeometryReader { proxy in
let bottomSafeArea = proxy.safeAreaInsets.bottom
VStack(spacing: 0) {
VStack(spacing: 8) {
title

if message != nil {
messageLabel
}
}
.padding(.top, 36)
.padding(.bottom, 20)

if message != nil {
messageLabel
PokitBottomSwitchRadio {
PokitPartSwitchRadio(
labelText: "취소",
selection: .constant(false),
to: true,
style: .stroke
) {
cancelAction?()
dismiss()
}
.background()

PokitPartSwitchRadio(
labelText: confirmText,
selection: .constant(true),
to: true,
style: .filled,
action: action
)
.background()
}
.pokitMaxWidth()
}
.padding(.top, 36)
.padding(.bottom, 20)

PokitBottomSwitchRadio {
PokitPartSwitchRadio(
labelText: "취소",
selection: .constant(false),
to: true,
style: .stroke
) {
cancelAction?()
dismiss()
.pokitPresentationBackground()
.pokitPresentationCornerRadius()
.presentationDragIndicator(.visible)
.padding(.bottom, 36 - bottomSafeArea)
.readHeight()
.onPreferenceChange(HeightPreferenceKey.self) { height in
if let height {
self.height = height
}
.background()

PokitPartSwitchRadio(
labelText: confirmText,
selection: .constant(true),
to: true,
style: .filled,
action: action
)
.background()
}
.pokitMaxWidth()
}
.pokitPresentationBackground()
.pokitPresentationCornerRadius()
.presentationDragIndicator(.visible)
.readHeight()
.onPreferenceChange(HeightPreferenceKey.self) { height in
if let height {
self.height = height
.presentationDetents([.height(self.height)])
.onAppear {
UINotificationFeedbackGenerator()
.notificationOccurred(.warning)
}
}
.presentationDetents([.height(self.height)])
.onAppear {
UINotificationFeedbackGenerator()
.notificationOccurred(.warning)
}
}

private var title: some View {
Expand Down
2 changes: 1 addition & 1 deletion Projects/DSKit/Sources/Components/PokitBottomButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public struct PokitBottomButton: View {
}
.disabled(state == .disable)
.padding(.top, 16)
.padding(.bottom, 36)
// .padding(.bottom, 36)
}

private var label: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public struct PokitBottomSwitchRadio<Content: View>: View {
}
.padding(.horizontal, 20)
.padding(.top, 16)
.padding(.bottom, 28)
// .padding(.bottom, 28)
.background(.pokit(.bg(.base)))
}
}
Expand Down
87 changes: 46 additions & 41 deletions Projects/DSKit/Sources/Components/PokitDeleteBottomSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,51 +22,56 @@ public struct PokitDeleteBottomSheet: View {
}

public var body: some View {
VStack(spacing: 0) {
/// - 텍스트 영역
VStack(spacing: 8) {
Text(type.sheetTitle)
.foregroundStyle(.pokit(.text(.primary)))
.pokitFont(.title2)
Text(type.sheetContents)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
.foregroundStyle(.pokit(.text(.secondary)))
.pokitFont(.b2(.m))
GeometryReader { proxy in
let bottomSafeArea = proxy.safeAreaInsets.bottom

VStack(spacing: 0) {
/// - 텍스트 영역
VStack(spacing: 8) {
Text(type.sheetTitle)
.foregroundStyle(.pokit(.text(.primary)))
.pokitFont(.title2)
Text(type.sheetContents)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
.foregroundStyle(.pokit(.text(.secondary)))
.pokitFont(.b2(.m))
}
.padding(.top, 36)
.padding(.bottom, 20)
/// - 취소 / 삭제 버튼 영역
HStack(spacing: 8) {
PokitBottomButton(
"취소",
state: .default(.primary),
action: { delegateSend?(.cancelButtonTapped) }
)

PokitBottomButton(
"삭제",
state: .filled(.primary),
action: { delegateSend?(.deleteButtonTapped) }
)
}
}
.padding(.top, 36)
.padding(.bottom, 20)
/// - 취소 / 삭제 버튼 영역
HStack(spacing: 8) {
PokitBottomButton(
"취소",
state: .default(.primary),
action: { delegateSend?(.cancelButtonTapped) }
)

PokitBottomButton(
"삭제",
state: .filled(.primary),
action: { delegateSend?(.deleteButtonTapped) }
)
.padding(.horizontal, 20)
.padding(.bottom, 36 - bottomSafeArea)
.background(.white)
.pokitPresentationCornerRadius()
.pokitPresentationBackground()
.presentationDragIndicator(.visible)
.readHeight()
.onPreferenceChange(HeightPreferenceKey.self) { height in
if let height {
self.height = height
}
}
}
.padding(.horizontal, 20)
.background(.white)
.pokitPresentationCornerRadius()
.pokitPresentationBackground()
.presentationDragIndicator(.visible)
.readHeight()
.onPreferenceChange(HeightPreferenceKey.self) { height in
if let height {
self.height = height
.presentationDetents([.height(self.height)])
.onAppear {
UINotificationFeedbackGenerator()
.notificationOccurred(.warning)
}
}
.presentationDetents([.height(self.height)])
.onAppear {
UINotificationFeedbackGenerator()
.notificationOccurred(.warning)
}
}
}
//MARK: - Delegate
Expand Down
Loading