From b874a829c3e59edc7d44abf9f5209f932a960f84 Mon Sep 17 00:00:00 2001 From: RAFA Date: Sat, 18 Jan 2025 13:49:25 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20#51=20-=20BasePickerViewModel=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Memento-iOS.xcodeproj/project.pbxproj | 1 + .../ViewModel/BasePickerViewModel.swift | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Memento-iOS/Memento-iOS/Source/Presentation/Add/Common/PickerButton/ViewModel/BasePickerViewModel.swift diff --git a/Memento-iOS/Memento-iOS.xcodeproj/project.pbxproj b/Memento-iOS/Memento-iOS.xcodeproj/project.pbxproj index 6f994a9..4a04432 100644 --- a/Memento-iOS/Memento-iOS.xcodeproj/project.pbxproj +++ b/Memento-iOS/Memento-iOS.xcodeproj/project.pbxproj @@ -44,6 +44,7 @@ Source/Presentation/Add/AddSchedule/View/AddScheduleView.swift, Source/Presentation/Add/AddSchedule/ViewModel/AddEventTitleViewModel.swift, Source/Presentation/Add/Common/PickerButton/Model/PickerButtonType.swift, + Source/Presentation/Add/Common/PickerButton/ViewModel/BasePickerViewModel.swift, Source/Presentation/Add/Common/Protocols/Presentable.swift, Source/Presentation/Add/Common/SegmentedMenu/Model/SegmentedMenuType.swift, Source/Presentation/Add/Common/SegmentedMenu/View/SegmentedMenuView.swift, diff --git a/Memento-iOS/Memento-iOS/Source/Presentation/Add/Common/PickerButton/ViewModel/BasePickerViewModel.swift b/Memento-iOS/Memento-iOS/Source/Presentation/Add/Common/PickerButton/ViewModel/BasePickerViewModel.swift new file mode 100644 index 0000000..ce27157 --- /dev/null +++ b/Memento-iOS/Memento-iOS/Source/Presentation/Add/Common/PickerButton/ViewModel/BasePickerViewModel.swift @@ -0,0 +1,28 @@ +// +// BasePickerViewModel.swift +// Memento-iOS +// +// Created by RAFA on 1/18/25. +// + +import Foundation + +class BasePickerViewModel: ObservableObject, Presentable { + + @Published var isPresented: Bool = false + @Published var isPressed: Bool = false + + func togglePresentation() { + isPresented.toggle() + isPressed = isPresented + } + + func setPressedState(_ pressed: Bool) { + isPressed = pressed + } + + func dismiss() { + isPresented = false + isPressed = false + } +}