diff --git a/Projects/App/Sources/Extension/ImagePicker.swift b/Projects/App/Sources/Extension/ImagePicker.swift new file mode 100644 index 0000000..17a8c46 --- /dev/null +++ b/Projects/App/Sources/Extension/ImagePicker.swift @@ -0,0 +1,42 @@ +// +// ImagePicker.swift +// Expo-iOS +// +// Created by 서지완 on 11/14/24. +// Copyright © 2024 SchoolofCompany. All rights reserved. +// + +import Foundation +import SwiftUI + +struct ImagePicker: UIViewControllerRepresentable { + @Binding var selectedImage: UIImage? + @Environment(\.presentationMode) private var presentationMode + + func makeUIViewController(context: UIViewControllerRepresentableContext) -> UIImagePickerController { + let picker = UIImagePickerController() + picker.delegate = context.coordinator + return picker + } + + func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext) {} + + func makeCoordinator() -> Coordinator { + Coordinator(self) + } + + class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { + let parent: ImagePicker + + init(_ parent: ImagePicker) { + self.parent = parent + } + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + if let image = info[.originalImage] as? UIImage { + parent.selectedImage = image + } + parent.presentationMode.wrappedValue.dismiss() + } + } +} diff --git a/Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift b/Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift index dd29ff1..bb682a5 100644 --- a/Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift +++ b/Projects/App/Sources/Feature/ExpoEditFeature/Sources/ExpoEditView.swift @@ -30,12 +30,13 @@ struct ExpoEditView: View { Text("박람회 수정하기") .expoFont(.body1R) } + ScrollView { VStack(alignment: .leading, spacing: 0) { Text("사진") .expoFont(.body2B) .padding(.leading, 14) - .padding(.top, 41) + .padding(.top, 20) ExpoIOSAsset.Assets.photoget.swiftUIImage .resizable() @@ -125,6 +126,8 @@ struct ExpoEditView: View { .expoFont(.caption2R) .expoColor(ExpoColor.main) } + + } Spacer() }