Skip to content

Commit

Permalink
feat: 검색결과 복사 기능 popup 추가 (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
hryeong66 committed Aug 7, 2024
1 parent fc1ab63 commit aa8f910
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Projects/Features/MyPage/Sources/MyPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
//

import SwiftUI

import DesignSystem
import ResourceKit
import PPACModels

import PopupView

public struct MyPageView: View {
@ObservedObject private var viewModel: MyPageViewModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import PPACModels
import ResourceKit
import DesignSystem

import PopupView

public struct SearchResultView: View {
@ObservedObject var viewModel: SearchResultViewModel

Expand Down Expand Up @@ -58,5 +60,10 @@ public struct SearchResultView: View {
.onAppear {
viewModel.dispatch(type: .viewWillAppear)
}
.popup(
isActive: $viewModel.state.isActiveCopyPopup,
image: ResourceKitAsset.Icon.copyFilled.swiftUIImage,
text: "이미지를 클립보드에 복사했어요"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public final class SearchResultViewModel: ViewModelType, ObservableObject {
public struct State {
var keyword: String
var memeList: [MemeDetail]
var isActiveCopyPopup: Bool = false
}

// MARK: - Properties
Expand Down Expand Up @@ -89,6 +90,7 @@ public final class SearchResultViewModel: ViewModelType, ObservableObject {
private func copyImage(urlString: String) async {
do {
try await copyImageUseCase.execute(url: urlString)
state.isActiveCopyPopup = true
} catch(let error) {
debugPrint("error = \(error)")
}
Expand Down

0 comments on commit aa8f910

Please sign in to comment.