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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
055503C22CDB55F5004D34EB /* SharePhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 055503C02CDB5589004D34EB /* SharePhotoViewController.swift */; };
055503C42CDB5608004D34EB /* SharePhotoFeature.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 055503882CDB54AF004D34EB /* SharePhotoFeature.framework */; };
055503C52CDB5608004D34EB /* SharePhotoFeature.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 055503882CDB54AF004D34EB /* SharePhotoFeature.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
60B03BF12CE4CE3100A7C748 /* SharePhotoBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60B03BF02CE4CE3100A7C748 /* SharePhotoBottomView.swift */; };
60B03BF32CE4CEDC00A7C748 /* DesignSystem.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60B03BF22CE4CEDC00A7C748 /* DesignSystem.framework */; };
60B03BF42CE4CEDC00A7C748 /* DesignSystem.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 60B03BF22CE4CEDC00A7C748 /* DesignSystem.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7B59510F2CDB598E00B89C85 /* FeatureTesting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B59510E2CDB598E00B89C85 /* FeatureTesting.framework */; };
7B5951102CDB598E00B89C85 /* FeatureTesting.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B59510E2CDB598E00B89C85 /* FeatureTesting.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7B5951522CDB600100B89C85 /* BaseFeature.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5951512CDB600100B89C85 /* BaseFeature.framework */; };
Expand Down Expand Up @@ -51,6 +54,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
60B03BF42CE4CEDC00A7C748 /* DesignSystem.framework in Embed Frameworks */,
7B5951D32CDB664300B89C85 /* PhotoGetherDomainInterface.framework in Embed Frameworks */,
7B5951532CDB600100B89C85 /* BaseFeature.framework in Embed Frameworks */,
);
Expand All @@ -68,6 +72,8 @@
055503B02CDB5500004D34EB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
055503B42CDB5500004D34EB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
055503C02CDB5589004D34EB /* SharePhotoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharePhotoViewController.swift; sourceTree = "<group>"; };
60B03BF02CE4CE3100A7C748 /* SharePhotoBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharePhotoBottomView.swift; sourceTree = "<group>"; };
60B03BF22CE4CEDC00A7C748 /* DesignSystem.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DesignSystem.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B59510E2CDB598E00B89C85 /* FeatureTesting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FeatureTesting.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B5951512CDB600100B89C85 /* BaseFeature.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = BaseFeature.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B59517A2CDB62A600B89C85 /* PresentationUtility.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PresentationUtility.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -79,6 +85,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
60B03BF32CE4CEDC00A7C748 /* DesignSystem.framework in Frameworks */,
7B5951D22CDB664300B89C85 /* PhotoGetherDomainInterface.framework in Frameworks */,
7B5951522CDB600100B89C85 /* BaseFeature.framework in Frameworks */,
);
Expand Down Expand Up @@ -155,13 +162,15 @@
isa = PBXGroup;
children = (
055503C02CDB5589004D34EB /* SharePhotoViewController.swift */,
60B03BF02CE4CE3100A7C748 /* SharePhotoBottomView.swift */,
);
path = Source;
sourceTree = "<group>";
};
055503C32CDB5608004D34EB /* Frameworks */ = {
isa = PBXGroup;
children = (
60B03BF22CE4CEDC00A7C748 /* DesignSystem.framework */,
7B5951D12CDB664300B89C85 /* PhotoGetherDomainInterface.framework */,
7B59517A2CDB62A600B89C85 /* PresentationUtility.framework */,
7B5951512CDB600100B89C85 /* BaseFeature.framework */,
Expand Down Expand Up @@ -287,6 +296,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
60B03BF12CE4CE3100A7C748 /* SharePhotoBottomView.swift in Sources */,
055503C22CDB55F5004D34EB /* SharePhotoViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -325,7 +335,7 @@
0555038F2CDB54AF004D34EB /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
Expand Down Expand Up @@ -363,7 +373,7 @@
055503902CDB54AF004D34EB /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import Combine
import DesignSystem
import UIKit

final class SharePhotoBottomView: UIView {
private let shareButton = PTGCircleButton(type: .share)
private let saveButton = PTGPrimaryButton()

var shareButtonTapped: AnyPublisher<Void, Never> {
return shareButton.tapPublisher
}

var saveButtonTapped: AnyPublisher<Void, Never> {
return saveButton.tapPublisher
}

override init(frame: CGRect) {
super.init(frame: frame)

addViews()
setupConstraints()
configureUI()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}


private func addViews() {
[shareButton, saveButton].forEach {
addSubview($0)
}
}

private func setupConstraints() {
shareButton.snp.makeConstraints {
$0.leading.equalToSuperview().inset(16)
$0.verticalEdges.equalToSuperview().inset(14)
$0.width.height.equalTo(52)
}

saveButton.snp.makeConstraints {
$0.leading.equalTo(shareButton.snp.trailing).offset(16)
$0.verticalEdges.equalTo(shareButton)
$0.trailing.equalToSuperview().inset(16)
}
}

private func configureUI() {
backgroundColor = .clear
saveButton.setTitle(to: "저장하기")
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import BaseFeature
import Combine
import DesignSystem
import UIKit

public class SharePhotoViewController: UIViewController {
public class SharePhotoViewController: BaseViewController {
private let navigationView = UIView()
private let photoView = UIImageView()
private let bottomView = SharePhotoBottomView()

public init() {
super.init(nibName: nil, bundle: nil)
}
Expand All @@ -11,6 +18,74 @@ public class SharePhotoViewController: UIViewController {

public override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .cyan

addViews()
setupConstraints()
configureUI()
bindOutput()
}

public override func addViews() {
[navigationView, photoView, bottomView].forEach {
view.addSubview($0)
}
}

public override func setupConstraints() {
navigationView.snp.makeConstraints {
$0.top.equalTo(view.safeAreaLayoutGuide)
$0.horizontalEdges.equalToSuperview()
$0.height.equalTo(48)
}

photoView.snp.makeConstraints {
$0.top.equalTo(navigationView.snp.bottom)
$0.horizontalEdges.equalToSuperview()
$0.bottom.equalTo(bottomView.snp.top)
}

bottomView.snp.makeConstraints {
$0.bottom.equalTo(view.safeAreaLayoutGuide)
$0.horizontalEdges.equalToSuperview()
$0.height.equalTo(80)
}
}

// MARK: Image가 원래는 바인딩 되어야 함
public override func configureUI() {
view.backgroundColor = PTGColor.gray90.color

photoView.image = PTGImage.frameIcon.image
photoView.backgroundColor = PTGColor.gray50.color
photoView.contentMode = .scaleAspectFit
}

public override func bindOutput() {
bottomView.shareButtonTapped
.sink { [weak self] _ in
self?.showShareSheet()
}
.store(in: &cancellables)

bottomView.saveButtonTapped
.sink { [weak self] _ in
self?.saveImage()
}
.store(in: &cancellables)
}

private func showShareSheet() {
if let image = photoView.image {
let activityViewController = UIActivityViewController(
activityItems: [image],
applicationActivities: nil
)
present(activityViewController, animated: true)
}
}

// TODO: 권한 요청 및 사진앱에 저장
private func saveImage() {

Comment on lines +88 to +89
Copy link
Collaborator

Choose a reason for hiding this comment

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

아직 사용하지 않는 코드로 보이는데 빼고 TODO만 남겨도 좋을것 같습니다 👍

}
}
Loading