Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
20 changes: 20 additions & 0 deletions PhotoGether/PhotoGether.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
7B17454B2CE35AE100E01D1A /* PhotoGetherDomain.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B1745492CE35AE100E01D1A /* PhotoGetherDomain.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7B17454D2CE35AE700E01D1A /* PhotoGetherDomainInterface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B17454C2CE35AE700E01D1A /* PhotoGetherDomainInterface.framework */; };
7B17454E2CE35AE700E01D1A /* PhotoGetherDomainInterface.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B17454C2CE35AE700E01D1A /* PhotoGetherDomainInterface.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7B17458F2CE6189000E01D1A /* WebRTC in Frameworks */ = {isa = PBXBuildFile; productRef = 7B17458E2CE6189000E01D1A /* WebRTC */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -57,6 +58,7 @@
buildActionMask = 2147483647;
files = (
053986052CDCAC3000E709AC /* PhotoGetherNetwork.framework in Frameworks */,
7B17458F2CE6189000E01D1A /* WebRTC in Frameworks */,
7B17454D2CE35AE700E01D1A /* PhotoGetherDomainInterface.framework in Frameworks */,
7B17454A2CE35AE100E01D1A /* PhotoGetherDomain.framework in Frameworks */,
);
Expand Down Expand Up @@ -149,6 +151,7 @@
);
name = PhotoGether;
packageProductDependencies = (
7B17458E2CE6189000E01D1A /* WebRTC */,
);
productName = PhotoGether;
productReference = 60CB81DA2CDA442700873DD6 /* PhotoGether.app */;
Expand Down Expand Up @@ -180,6 +183,7 @@
minimizedProjectReferenceProxies = 1;
packageReferences = (
7B0318C12CDBA8A30026C613 /* XCRemoteSwiftPackageReference "SwiftLint" */,
7B17458D2CE6189000E01D1A /* XCRemoteSwiftPackageReference "WebRTC" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = 60CB81DB2CDA442700873DD6 /* Products */;
Expand Down Expand Up @@ -477,7 +481,23 @@
minimumVersion = 0.57.0;
};
};
7B17458D2CE6189000E01D1A /* XCRemoteSwiftPackageReference "WebRTC" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/stasel/WebRTC";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 130.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
7B17458E2CE6189000E01D1A /* WebRTC */ = {
isa = XCSwiftPackageProductDependency;
package = 7B17458D2CE6189000E01D1A /* XCRemoteSwiftPackageReference "WebRTC" */;
productName = WebRTC;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 60CB81D22CDA442700873DD6 /* Project object */;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
/* Begin PBXBuildFile section */
7B1745422CE350DE00E01D1A /* UIButton+Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B17453F2CE350DE00E01D1A /* UIButton+Publisher.swift */; };
7B1745432CE350DE00E01D1A /* UIControl+Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1745402CE350DE00E01D1A /* UIControl+Publisher.swift */; };
7B1745842CE5DDFF00E01D1A /* UILabel+setKern.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1745832CE5DDF600E01D1A /* UILabel+setKern.swift */; };
7B5951552CDB601900B89C85 /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5951442CDB5E7100B89C85 /* BaseViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
7B17453F2CE350DE00E01D1A /* UIButton+Publisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIButton+Publisher.swift"; sourceTree = "<group>"; };
7B1745402CE350DE00E01D1A /* UIControl+Publisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl+Publisher.swift"; sourceTree = "<group>"; };
7B1745832CE5DDF600E01D1A /* UILabel+setKern.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UILabel+setKern.swift"; sourceTree = "<group>"; };
7B5951382CDB5E5500B89C85 /* BaseFeature.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BaseFeature.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B5951442CDB5E7100B89C85 /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand All @@ -33,6 +35,7 @@
7B1745412CE350DE00E01D1A /* Extension */ = {
isa = PBXGroup;
children = (
7B1745832CE5DDF600E01D1A /* UILabel+setKern.swift */,
7B17453F2CE350DE00E01D1A /* UIButton+Publisher.swift */,
7B1745402CE350DE00E01D1A /* UIControl+Publisher.swift */,
);
Expand Down Expand Up @@ -146,6 +149,7 @@
buildActionMask = 2147483647;
files = (
7B1745422CE350DE00E01D1A /* UIButton+Publisher.swift in Sources */,
7B1745842CE5DDFF00E01D1A /* UILabel+setKern.swift in Sources */,
7B1745432CE350DE00E01D1A /* UIControl+Publisher.swift in Sources */,
7B5951552CDB601900B89C85 /* BaseViewController.swift in Sources */,
);
Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

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

자간 설정하는건 처음보는데 이렇게 하는군요!

저희도 라벨 쓰는곳이 있었는데 디벨롭에 들어오면 적용해봐야겠네요 ☺️

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import UIKit

public extension UILabel {
/// 자간을 설정하는 메소드입니다.
/// - Parameter kernValue: 자간입니다.
/// - Parameter lineBreakMode: 텍스트가 짤릴 경우 어떻게 처리할 것인지
/// - Parameter alignment: 텍스트를 어떻게 정렬할 것인지
func setKern(
kernValue: Double? = -0.32,
lineBreakMode: NSLineBreakMode = .byTruncatingTail,
alignment: NSTextAlignment = .left
) {
let paragraphStyle = NSMutableParagraphStyle()

paragraphStyle.lineBreakMode = lineBreakMode
paragraphStyle.alignment = alignment

let attributes: [NSAttributedString.Key: Any] = [
.paragraphStyle: paragraphStyle,
.kern: kernValue ?? 0.0
]
let attributedString = NSMutableAttributedString(string: text ?? "", attributes: attributes)

self.attributedText = attributedString
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import Foundation
import Combine

public final class EditPhotoRoomHostViewModel {
enum Input {
case stickerButtonDidTap
}

enum Output {
case rectangle(rect: Rectangle)
}

private var cancellables = Set<AnyCancellable>()
private var output = PassthroughSubject<Output, Never>()

public init() { }

func transform(input: AnyPublisher<Input, Never>) -> AnyPublisher<Output, Never> {
input.sink { [weak self] in
switch $0 {
case .stickerButtonDidTap:
self?.generateRectangle()
}
}
.store(in: &cancellables)

return output.eraseToAnyPublisher()
}

private func generateRectangle() {
let randomX = Int.random(in: 10..<100)
let randomY = Int.random(in: 10..<100)
let width = Int.random(in: 10..<100)
let height = Int.random(in: 10..<100)

let rectangle = Rectangle(
position: CGPoint(x: randomX, y: randomY),
size: CGSize(width: width, height: height)
)

output.send(.rectangle(rect: rectangle))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@

/* Begin PBXBuildFile section */
05729E012CE59967005F6994 /* Secrets.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 05729E002CE59967005F6994 /* Secrets.xcconfig */; };
60348F502CE5C2EA002D1CEE /* ParticipantsCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60348F4F2CE5C2EA002D1CEE /* ParticipantsCollectionViewController.swift */; };
60348F522CE5C492002D1CEE /* ParticipantsCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60348F512CE5C492002D1CEE /* ParticipantsCollectionViewCell.swift */; };
60CB82472CDA4BBC00873DD6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60CB823D2CDA4BBC00873DD6 /* AppDelegate.swift */; };
60CB82482CDA4BBC00873DD6 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60CB82442CDA4BBC00873DD6 /* SceneDelegate.swift */; };
60CB824A2CDA4BBC00873DD6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 60CB823E2CDA4BBC00873DD6 /* Assets.xcassets */; };
60CB824C2CDA4BBC00873DD6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 60CB82412CDA4BBC00873DD6 /* LaunchScreen.storyboard */; };
60CB824F2CDA4BDB00873DD6 /* PhotoRoomFeature.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 60CB820E2CDA4B5E00873DD6 /* PhotoRoomFeature.framework */; };
60CB82502CDA4BDB00873DD6 /* PhotoRoomFeature.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 60CB820E2CDA4B5E00873DD6 /* PhotoRoomFeature.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
60CB82542CDA4C6E00873DD6 /* PhotoRoomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60CB82222CDA4B7F00873DD6 /* PhotoRoomViewController.swift */; };
7B1745752CE5CD9E00E01D1A /* ParticipantsCollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1745742CE5CD9600E01D1A /* ParticipantsCollectionViewDataSource.swift */; };
7B17457C2CE5CE4B00E01D1A /* ParticipantsSectionItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B17457B2CE5CE4B00E01D1A /* ParticipantsSectionItem.swift */; };
7B5951092CDB597D00B89C85 /* FeatureTesting.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5951082CDB597D00B89C85 /* FeatureTesting.framework */; };
7B59510A2CDB597D00B89C85 /* FeatureTesting.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5951082CDB597D00B89C85 /* FeatureTesting.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
7B59514A2CDB5FF700B89C85 /* BaseFeature.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B5951492CDB5FF700B89C85 /* BaseFeature.framework */; };
Expand Down Expand Up @@ -62,6 +66,8 @@

/* Begin PBXFileReference section */
05729E002CE59967005F6994 /* Secrets.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Secrets.xcconfig; sourceTree = "<group>"; };
60348F4F2CE5C2EA002D1CEE /* ParticipantsCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantsCollectionViewController.swift; sourceTree = "<group>"; };
60348F512CE5C492002D1CEE /* ParticipantsCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantsCollectionViewCell.swift; sourceTree = "<group>"; };
60CB820E2CDA4B5E00873DD6 /* PhotoRoomFeature.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = PhotoRoomFeature.framework; sourceTree = BUILT_PRODUCTS_DIR; };
60CB82222CDA4B7F00873DD6 /* PhotoRoomViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoRoomViewController.swift; sourceTree = "<group>"; };
60CB82282CDA4BB000873DD6 /* PhotoRoomFeatureDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PhotoRoomFeatureDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -70,6 +76,8 @@
60CB823F2CDA4BBC00873DD6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
60CB82402CDA4BBC00873DD6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
60CB82442CDA4BBC00873DD6 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
7B1745742CE5CD9600E01D1A /* ParticipantsCollectionViewDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantsCollectionViewDataSource.swift; sourceTree = "<group>"; };
7B17457B2CE5CE4B00E01D1A /* ParticipantsSectionItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticipantsSectionItem.swift; sourceTree = "<group>"; };
7B5951082CDB597D00B89C85 /* FeatureTesting.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = FeatureTesting.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B5951492CDB5FF700B89C85 /* BaseFeature.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = BaseFeature.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7B5951742CDB629F00B89C85 /* PresentationUtility.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = PresentationUtility.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -128,7 +136,11 @@
60CB82232CDA4B7F00873DD6 /* Source */ = {
isa = PBXGroup;
children = (
60CB82222CDA4B7F00873DD6 /* PhotoRoomViewController.swift */,
7B17457A2CE5CE2800E01D1A /* DataSource */,
7B1745792CE5CE0F00E01D1A /* Model */,
7B1745762CE5CDFD00E01D1A /* ViewModel */,
7B1745772CE5CE0600E01D1A /* ViewController */,
7B1745782CE5CE0B00E01D1A /* View */,
);
path = Source;
sourceTree = "<group>";
Expand Down Expand Up @@ -173,6 +185,46 @@
path = App;
sourceTree = "<group>";
};
7B1745762CE5CDFD00E01D1A /* ViewModel */ = {
isa = PBXGroup;
children = (
);
path = ViewModel;
sourceTree = "<group>";
};
7B1745772CE5CE0600E01D1A /* ViewController */ = {
isa = PBXGroup;
children = (
60CB82222CDA4B7F00873DD6 /* PhotoRoomViewController.swift */,
60348F4F2CE5C2EA002D1CEE /* ParticipantsCollectionViewController.swift */,
);
path = ViewController;
sourceTree = "<group>";
};
7B1745782CE5CE0B00E01D1A /* View */ = {
isa = PBXGroup;
children = (
60348F512CE5C492002D1CEE /* ParticipantsCollectionViewCell.swift */,
);
path = View;
sourceTree = "<group>";
};
7B1745792CE5CE0F00E01D1A /* Model */ = {
isa = PBXGroup;
children = (
7B17457B2CE5CE4B00E01D1A /* ParticipantsSectionItem.swift */,
);
path = Model;
sourceTree = "<group>";
};
7B17457A2CE5CE2800E01D1A /* DataSource */ = {
isa = PBXGroup;
children = (
7B1745742CE5CD9600E01D1A /* ParticipantsCollectionViewDataSource.swift */,
);
path = DataSource;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXHeadersBuildPhase section */
Expand Down Expand Up @@ -291,6 +343,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
60348F522CE5C492002D1CEE /* ParticipantsCollectionViewCell.swift in Sources */,
60348F502CE5C2EA002D1CEE /* ParticipantsCollectionViewController.swift in Sources */,
7B17457C2CE5CE4B00E01D1A /* ParticipantsSectionItem.swift in Sources */,
7B1745752CE5CD9E00E01D1A /* ParticipantsCollectionViewDataSource.swift in Sources */,
60CB82542CDA4C6E00873DD6 /* PhotoRoomViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import UIKit

public typealias Section = Int
public typealias SectionItem = ParticipantsSectionItem

public final class ParticipantsCollectionViewDataSource: UICollectionViewDiffableDataSource<Section, SectionItem> {
public static func create(
collectionView: UICollectionView
) -> UICollectionViewDiffableDataSource<Section, SectionItem> {
let dataSource = UICollectionViewDiffableDataSource<Section, SectionItem>(
collectionView: collectionView
) { collectionView, indexPath, _ in
return configureCell(collectionView: collectionView, indexPath: indexPath)
}
return dataSource
}

private static func configureCell(
collectionView: UICollectionView,
indexPath: IndexPath
) -> UICollectionViewCell? {
guard let cell = collectionView.dequeueReusableCell(
withReuseIdentifier: ParticipantsCollectionViewCell.reuseIdentifier,
for: indexPath
) as? ParticipantsCollectionViewCell else {
return UICollectionViewCell()
}
return cell
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Foundation

public struct ParticipantsSectionItem: Hashable, Equatable {
public private(set) var nickname: String
public let videoID: Int
private let identifier = UUID()

public init(videoID: Int, nickname: String) {
self.videoID = videoID
self.nickname = nickname
}

public mutating func setNickname(_ nickname: String) {
self.nickname = nickname
}
}

public extension ParticipantsSectionItem {
func hash(into hasher: inout Hasher) {
hasher.combine(identifier)
}

static func == (lhs: ParticipantsSectionItem, rhs: ParticipantsSectionItem) -> Bool {
lhs.identifier == rhs.identifier
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import UIKit
import BaseFeature
import SnapKit

public final class ParticipantsCollectionViewCell: UICollectionViewCell {
public static let reuseIdentifier = "\(ParticipantsCollectionViewCell.self)"

private let nicknameLabel = UILabel()
private var videoView = UIView()

public override init(frame: CGRect) {
super.init(frame: frame)
addViews()
setConstraints()
configureUI()
}

public required init?(coder: NSCoder) {
fatalError()
}

public func setNickname(_ nickname: String) {
self.nicknameLabel.text = nickname
}

public func setVideoView(_ videoView: UIView) {
self.videoView = videoView
}

private func addViews() {
[videoView, nicknameLabel].forEach {
contentView.addSubview($0)
}
}

private func setConstraints() {
videoView.snp.makeConstraints {
$0.edges.equalToSuperview()
}

nicknameLabel.snp.makeConstraints {
$0.width.equalTo(Constants.nicknameLabelWidth)
$0.height.equalTo(Constants.nicknameLabelHeight)
$0.top.equalToSuperview().offset(Constants.nicknameLabelTopSpacing)
$0.trailing.equalToSuperview().inset(Constants.nicknameLabelTrailingSpacing)
}
}

private func configureUI() {
nicknameLabel.font = .systemFont(ofSize: 11)
nicknameLabel.setKern()
nicknameLabel.textColor = .white.withAlphaComponent(0.8)
nicknameLabel.backgroundColor = UIColor.black.withAlphaComponent(0.4)
nicknameLabel.layer.cornerRadius = 20
}
}

extension ParticipantsCollectionViewCell {
enum Constants {
static let nicknameLabelWidth: CGFloat = 40
static let nicknameLabelHeight: CGFloat = 20
static let nicknameLabelTopSpacing: CGFloat = 8
static let nicknameLabelTrailingSpacing: CGFloat = 8
}
}
Loading
Loading