Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 지도 탭 api 연결 #247

Merged
merged 17 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 9 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
14 changes: 9 additions & 5 deletions iOS/Layover/Layover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@
FC68E2A32B0233BC001AABFF /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC68E2A22B0233BC001AABFF /* NetworkError.swift */; };
FC68E2A52B0233D3001AABFF /* Provider.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC68E2A42B0233D3001AABFF /* Provider.swift */; };
FC70BB2B2B20718A00B37CBE /* VideoPickerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC70BB2A2B20718A00B37CBE /* VideoPickerManager.swift */; };
FC70BB2F2B20B66300B37CBE /* MapWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC70BB2E2B20B66300B37CBE /* MapWorker.swift */; };
FC70BB332B20C96200B37CBE /* LOAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC70BB322B20C96200B37CBE /* LOAnnotation.swift */; };
FC767F842B1214A80088CF9B /* MockUserWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC767F832B1214A70088CF9B /* MockUserWorker.swift */; };
FC767F862B1214C10088CF9B /* CheckUserNameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC767F852B1214C10088CF9B /* CheckUserNameDTO.swift */; };
FC767F932B1220CC0088CF9B /* NicknameDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC767F922B1220CC0088CF9B /* NicknameDTO.swift */; };
Expand All @@ -186,7 +188,6 @@
FC767FA32B12283D0088CF9B /* PatchProfileImage.json in Resources */ = {isa = PBXBuildFile; fileRef = FC767F9E2B12283D0088CF9B /* PatchProfileImage.json */; };
FC767FA52B125F430088CF9B /* UIViewController+.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC767FA42B125F430088CF9B /* UIViewController+.swift */; };
FC767FA82B1269DB0088CF9B /* LOAnnotationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC767FA72B1269DB0088CF9B /* LOAnnotationView.swift */; };
FC767FAA2B126D080088CF9B /* LOAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC767FA92B126D080088CF9B /* LOAnnotation.swift */; };
FC7E453A2AFEB623004F155A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC7E45392AFEB623004F155A /* AppDelegate.swift */; };
FC7E453C2AFEB623004F155A /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC7E453B2AFEB623004F155A /* SceneDelegate.swift */; };
FC7E45432AFEB62B004F155A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FC7E45422AFEB62B004F155A /* Assets.xcassets */; };
Expand Down Expand Up @@ -387,6 +388,8 @@
FC68E2A22B0233BC001AABFF /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = "<group>"; };
FC68E2A42B0233D3001AABFF /* Provider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Provider.swift; sourceTree = "<group>"; };
FC70BB2A2B20718A00B37CBE /* VideoPickerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoPickerManager.swift; sourceTree = "<group>"; };
FC70BB2E2B20B66300B37CBE /* MapWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapWorker.swift; sourceTree = "<group>"; };
FC70BB322B20C96200B37CBE /* LOAnnotation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LOAnnotation.swift; sourceTree = "<group>"; };
FC767F832B1214A70088CF9B /* MockUserWorker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockUserWorker.swift; sourceTree = "<group>"; };
FC767F852B1214C10088CF9B /* CheckUserNameDTO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckUserNameDTO.swift; sourceTree = "<group>"; };
FC767F922B1220CC0088CF9B /* NicknameDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameDTO.swift; sourceTree = "<group>"; };
Expand All @@ -399,7 +402,6 @@
FC767F9E2B12283D0088CF9B /* PatchProfileImage.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = PatchProfileImage.json; sourceTree = "<group>"; };
FC767FA42B125F430088CF9B /* UIViewController+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+.swift"; sourceTree = "<group>"; };
FC767FA72B1269DB0088CF9B /* LOAnnotationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOAnnotationView.swift; sourceTree = "<group>"; };
FC767FA92B126D080088CF9B /* LOAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LOAnnotation.swift; sourceTree = "<group>"; };
FC7E45362AFEB623004F155A /* Layover.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Layover.app; sourceTree = BUILT_PRODUCTS_DIR; };
FC7E45392AFEB623004F155A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
FC7E453B2AFEB623004F155A /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -754,13 +756,14 @@
isa = PBXGroup;
children = (
FC767FA62B1269980088CF9B /* Views */,
FC767FA92B126D080088CF9B /* LOAnnotation.swift */,
FC70BB322B20C96200B37CBE /* LOAnnotation.swift */,
FC2511A82B04DAD4004717BC /* MapViewController.swift */,
FC2511AC2B04EACD004717BC /* MapInteractor.swift */,
FC2511AE2B04EAD9004717BC /* MapPresenter.swift */,
FC2511AA2B04EA6B004717BC /* MapConfigurator.swift */,
FC70BB2E2B20B66300B37CBE /* MapWorker.swift */,
FC2511B02B04EAEC004717BC /* MapModels.swift */,
836C33902B17629400ECAFB0 /* MapRouter.swift */,
FC2511AA2B04EA6B004717BC /* MapConfigurator.swift */,
);
path = Map;
sourceTree = "<group>";
Expand Down Expand Up @@ -1202,6 +1205,7 @@
FC3752342B170A620000D439 /* EditVideoViewController.swift in Sources */,
19A169442B17C71C00DB34C0 /* Board.swift in Sources */,
194552252B0478B400299768 /* HomeViewController.swift in Sources */,
FC70BB2F2B20B66300B37CBE /* MapWorker.swift in Sources */,
FC4084C62B1F1C5B00CE4727 /* UploadPostDTO.swift in Sources */,
194552222B0478B400299768 /* HomeWorker.swift in Sources */,
194C21BD2B1B728600C62645 /* StubAuthManager.swift in Sources */,
Expand All @@ -1227,7 +1231,6 @@
8321A2F12B1E1026000A12AF /* ReportModels.swift in Sources */,
FC2511A62B049020004717BC /* SignUpConfigurator.swift in Sources */,
194552392B05230E00299768 /* HomeCarouselCollectionViewCell.swift in Sources */,
FC767FAA2B126D080088CF9B /* LOAnnotation.swift in Sources */,
19A169472B17D12500DB34C0 /* MockTagPlayListWorker.swift in Sources */,
193686722B15BCA7008902CD /* UserEndPointFactory.swift in Sources */,
194551F22B037F2D00299768 /* LoginPresenter.swift in Sources */,
Expand Down Expand Up @@ -1291,6 +1294,7 @@
FC4084C42B1F14F600CE4727 /* UploadPostEndPointFactory.swift in Sources */,
FC5BE1232B1490660036366D /* EditProfileConfigurator.swift in Sources */,
1945522A2B04883800299768 /* UIView+.swift in Sources */,
FC70BB332B20C96200B37CBE /* LOAnnotation.swift in Sources */,
FCE52FFA2B0FCB0A002CDB75 /* URLSession+.swift in Sources */,
19743C052B06940D001E405A /* PlayerView.swift in Sources */,
1915D6E52B1FB82000CE1DD0 /* CheckSignUpDTO.swift in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions iOS/Layover/Layover/Models/Board.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ struct Board {
let description: String?
let thumbnailImageURL: URL?
let videoURL: URL?
let latitude: Double?
let longitude: Double?
let latitude: Double
let longitude: Double
}
7 changes: 4 additions & 3 deletions iOS/Layover/Layover/Network/DTOs/BoardDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ struct BoardDTO: Decodable {
let id: Int
let encodedVideoURL: String
let videoThumbnailURL: String
let latitude, longitude, title, content: String
let latitude, longitude: Double
let title, content: String

enum CodingKeys: String, CodingKey {
case id
Expand All @@ -30,8 +31,8 @@ extension BoardDTO {
description: content,
thumbnailImageURL: URL(string: videoThumbnailURL),
videoURL: URL(string: encodedVideoURL),
latitude: Double(latitude),
longitude: Double(longitude)
latitude: latitude,
longitude: longitude
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation

protocol PostEndPointFactory {
func makeHomePostListEndPoint() -> EndPoint<Response<[PostDTO]>>
func makeMapPostListEndPoint(latitude: Double, longitude: Double) -> EndPoint<Response<[PostDTO]>>
func makeTagSearchPostListEndPoint(by tag: String) -> EndPoint<Response<[PostDTO]>>
}

Expand All @@ -21,6 +22,18 @@ final class DefaultPostEndPointFactory: PostEndPointFactory {
)
}

func makeMapPostListEndPoint(latitude: Double, longitude: Double) -> EndPoint<Response<[PostDTO]>> {
var queryParameters = [String: String]()
queryParameters.updateValue(String(latitude), forKey: "latitude")
queryParameters.updateValue(String(longitude), forKey: "longitude")

return EndPoint(
path: "/board/map",
method: .GET,
queryParameters: queryParameters
)
}

func makeTagSearchPostListEndPoint(by tag: String) -> EndPoint<Response<[PostDTO]>> {
var queryParameters = [String: String]()
queryParameters.updateValue(tag, forKey: "tag")
Expand Down
12 changes: 9 additions & 3 deletions iOS/Layover/Layover/Scenes/Map/LOAnnotation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
import MapKit

final class LOAnnotation: NSObject, MKAnnotation {

@objc dynamic var coordinate: CLLocationCoordinate2D
let thumbnailURL: URL
let boardID: Int
let thumbnailImageData: Data

init(coordinate: CLLocationCoordinate2D, thumbnailURL: URL) {
init(coordinate: CLLocationCoordinate2D,
boardID: Int,
thumbnailImageData: Data) {
self.coordinate = coordinate
self.thumbnailURL = thumbnailURL
self.boardID = boardID
self.thumbnailImageData = thumbnailImageData
}

}
2 changes: 2 additions & 0 deletions iOS/Layover/Layover/Scenes/Map/MapConfigurator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ final class MapConfigurator: Configurator {
let interactor = MapInteractor()
let presenter = MapPresenter()
let router = MapRouter()
let worker = MapWorker()
let videoFileWorker = VideoFileWorker()

router.viewController = viewController
viewController.interactor = interactor
interactor.presenter = presenter
interactor.worker = worker
interactor.videoFileWorker = videoFileWorker
presenter.viewController = viewController
viewController.router = router
Expand Down
65 changes: 35 additions & 30 deletions iOS/Layover/Layover/Scenes/Map/MapInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ import Foundation

protocol MapBusinessLogic {
func checkLocationAuthorizationStatus()
func fetchVideos()
func moveToPlaybackScene(with: MapModels.MoveToPlaybackScene.Request)
func playPosts(with: MapModels.PlayPosts.Request)

@discardableResult
func fetchPosts() -> Task<[MapModels.Post], Never>

@discardableResult
func fetchPost(latitude: Double, longitude: Double) -> Task<[MapModels.Post], Never>
func selectVideo(with request: MapModels.SelectVideo.Request)
}

protocol MapDataStore {
var postPlayStartIndex: Int? { get set }
var posts: [Post]? { get set }
var index: Int? { get set }
var selectedVideoURL: URL? { get set }
}

Expand All @@ -31,10 +34,9 @@ final class MapInteractor: NSObject, MapBusinessLogic, MapDataStore {
typealias Models = MapModels
var presenter: MapPresentationLogic?
var videoFileWorker: VideoFileWorker?
var worker: MapWorkerProtocol?

private let locationManager = CLLocationManager()
private var latitude: Double?
private var longitude: Double?

var postPlayStartIndex: Int?
var posts: [Post]?
Expand All @@ -50,27 +52,38 @@ final class MapInteractor: NSObject, MapBusinessLogic, MapDataStore {
checkCurrentLocationAuthorization(for: locationManager.authorizationStatus)
}

func fetchVideos() {
// TODO: worker 네트워크 호출
let dummyURLs: [URL] = ["http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8",
"https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8",
"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8",
"https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8",
"https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8",
"https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8"]
.compactMap { URL(string: $0) }
presenter?.presentFetchedVideos(with: MapModels.FetchVideo.Reponse(videoURLs: dummyURLs))
func playPosts(with request: MapModels.PlayPosts.Request) {
postPlayStartIndex = request.selectedIndex
presenter?.presentPlaybackScene()
}

func moveToPlaybackScene(with request: Models.MoveToPlaybackScene.Request) {
posts = request.videos
index = request.index
presenter?.presentPlaybackScene()
func fetchPosts() -> Task<[MapModels.Post], Never> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

보니까 받는 데서는 결과를 쓰지 않는 모양인 것 같은데 그냥 반환 성공하면 true리턴?이 낫지 않나요

Copy link
Member Author

Choose a reason for hiding this comment

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

추후에 Task 리턴을 들어내야하긴 하지만..?
테스트하는 입장에서 생각해보면 빈배열보다는 지웅님 말씀처럼 불리언 타입이 나을 것 같네용..
이참에 그냥 없애버릴까요..

Copy link
Collaborator

Choose a reason for hiding this comment

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

Test를 위해 Bool을 쓰긴 하는거니까요... 먼가 애매애매하군요.. 고민이 필요해 보입니다..!

Copy link
Collaborator

@loinsir loinsir Dec 8, 2023

Choose a reason for hiding this comment

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

멘토님 말씀처럼 정답이 없다고 하셔가지고
-> 박터지는 싸움의 현장(어떻게 Task 블록으로만 감싸진 메서드를 테스트할 것인가)
논의가 필요할 것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

저는 개인적으로 멘토님이 처음 말씀해주신 의견에 동의하긴 합니다 !
어쨌든 테스트로 인해서 프로덕트 코드가 변경되어야한다는 점이 최대 단점같아서요. 여러분 생각도 궁금하네용

Copy link
Collaborator

@loinsir loinsir Dec 8, 2023

Choose a reason for hiding this comment

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

이건 추후 리팩토링 할 떄 의제로 남겨놓을게요 ADR ADR...

Task {
locationManager.startUpdatingLocation()
guard let coordinate = locationManager.location?.coordinate else { return [] }
let posts = await worker?.fetchPosts(latitude: coordinate.latitude,
longitude: coordinate.longitude)
guard let posts else { return [] }
self.posts = posts.map { .init(member: $0.member, board: $0.board, tag: $0.tag) }
let response = Models.FetchPosts.Response(posts: posts)
await MainActor.run {
presenter?.presentFetchedPosts(with: response)
}
return posts
}
}

func playPosts(with request: MapModels.PlayPosts.Request) {
postPlayStartIndex = request.selectedIndex
presenter?.presentPlaybackScene()
func fetchPost(latitude: Double, longitude: Double) -> Task<[MapModels.Post], Never> {
Task {
let posts = await worker?.fetchPosts(latitude: latitude, longitude: longitude)
guard let posts else { return [] }
self.posts = posts.map { .init(member: $0.member, board: $0.board, tag: $0.tag) }
let response = Models.FetchPosts.Response(posts: posts)
await MainActor.run {
presenter?.presentFetchedPosts(with: response)
}
return posts
}
}

func selectVideo(with request: Models.SelectVideo.Request) {
Expand All @@ -95,12 +108,4 @@ extension MapInteractor: CLLocationManagerDelegate {
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
checkCurrentLocationAuthorization(for: manager.authorizationStatus)
}

func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = locations.first {
longitude = location.coordinate.longitude
latitude = location.coordinate.latitude
}
}

}
46 changes: 20 additions & 26 deletions iOS/Layover/Layover/Scenes/Map/MapModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,40 @@ import Foundation

enum MapModels {

// MARK: - Fetch Video Use Cases
enum FetchVideo {
struct Request {
var latitude: Double
var longitude: Double
}

struct Reponse {
var videoURLs: [URL]
}

struct ViewModel {
var videoDataSources: [VideoDataSource]
struct Post {
let member: Member
let board: Board
let tag: [String]
anyukyung marked this conversation as resolved.
Show resolved Hide resolved
let thumnailImageData: Data
}

struct VideoDataSource: Hashable {
var id = UUID()
var videoURL: URL
}
}
struct DisplayedPost: Hashable {
let boardID: Int
let thumbnailImageData: Data
let videoURL: URL
let latitude: Double
let longitude: Double
}

// MARK: - Move To Playback Scene
// MARK: - Fetch Video Use Cases

enum MoveToPlaybackScene {
enum FetchPosts {
struct Request {
let index: Int
let videos: [Post]
var latitude: Double
var longitude: Double
}

struct Response {
let index: Int
let videos: [Post]
var posts: [Post]
}

struct ViewModel {
let index: Int
let videos: [Post]
var displayedPosts: [DisplayedPost]
}
}

// MARK: - Move To Playback Scene

enum PlayPosts {
struct Request {
let selectedIndex: Int
Expand Down
21 changes: 17 additions & 4 deletions iOS/Layover/Layover/Scenes/Map/MapPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Foundation
protocol MapPresentationLogic {
func presentCurrentLocation()
func presentDefaultLocation()
func presentFetchedVideos(with response: MapModels.FetchVideo.Reponse)
func presentFetchedPosts(with response: MapModels.FetchPosts.Response)
func presentPlaybackScene()
}

Expand All @@ -30,9 +30,22 @@ final class MapPresenter: MapPresentationLogic {
// TODO: 위치 관련 기능 사용 불가, 디폴트 위치로 이동
}

func presentFetchedVideos(with response: MapModels.FetchVideo.Reponse) {
let viewModel = MapModels.FetchVideo.ViewModel(videoDataSources: response.videoURLs.map { .init(videoURL: $0) })
viewController?.displayFetchedVideos(viewModel: viewModel)
func presentFetchedPosts(with response: MapModels.FetchPosts.Response) {
let displayedPost = response.posts
.map { post -> Models.DisplayedPost? in
if let videoURL = post.board.videoURL {
return .init(boardID: post.board.identifier,
thumbnailImageData: post.thumnailImageData,
videoURL: videoURL,
latitude: post.board.latitude,
longitude: post.board.longitude)
} else {
return nil
}
}.compactMap { $0 }

let viewModel = Models.FetchPosts.ViewModel(displayedPosts: displayedPost)
viewController?.dispalyFetchedPosts(viewModel: viewModel)
}

func presentPlaybackScene() {
Expand Down
2 changes: 1 addition & 1 deletion iOS/Layover/Layover/Scenes/Map/MapRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class MapRouter: MapRoutingLogic, MapDataPassing {
let destination = playbackViewController.router?.dataStore
else { return }
destination.parentView = .other
destination.index = source.index
destination.index = source.postPlayStartIndex
destination.posts = source.posts
Comment on lines 34 to 36
Copy link
Collaborator

Choose a reason for hiding this comment

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

지난번 얘기한 대로 datapass 메서드로 분리되었으면 좋겠습니다

Copy link
Collaborator

Choose a reason for hiding this comment

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

저희 datapass 메소드 분리하나요? 👀

Copy link
Collaborator

@loinsir loinsir Dec 8, 2023

Choose a reason for hiding this comment

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

엇 저희 지난번에 요 내용 토대로 분리하기로 합의한 게 아니었나요...?

Copy link
Collaborator

Choose a reason for hiding this comment

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

합의요? 따로 의사결정을 한 기억은 없는데.. 일단 알겠습니다~ 나중에 저도 반영하도록 할게요

Copy link
Member Author

Choose a reason for hiding this comment

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

datapass 분리 (inout 사용) vs 그냥 참조해서 변경 두가지 의견이 있었던걸로 기억합니다 !!
둘중에 어떤 방법으로 할지 정확히 정하진 않은 것 같은데 (기억이 가물가물..ㅎ) 지금 정하면 좋을 듯 ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

처음 Clean Swift의 Router의 의도가 데이터 전달 과 네비게이팅 분리라는 관점에서 저는 datapass분리도 괜찮다고 생각해요~ inout을 쓰면 순수함수를 잘 못지키는 것 같아 별로 쓰고 싶지 않았을 뿐, Clean Swift의 의도에 따라가려면 datapass가 더 적합한것 같습니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

이전에 단순 참조해서 변경한 코드들이 있어서, 저도 datapass 메소드 분리하는 방향으로 수정해보겠습니다 :D

Copy link
Collaborator

@loinsir loinsir Dec 8, 2023

Choose a reason for hiding this comment

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

아 이전에 https://clean-swift.com/pass-data-backward-more-elegantly-without-using-delegation/
요 내용 유경님께서 공유해주셨을때, 이견이 없으셔서 전 이렇게 하기로 합의한 것으로 받아들였었습니다...!

Copy link
Member Author

@anyukyung anyukyung Dec 8, 2023

Choose a reason for hiding this comment

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

아 저거는 메소드 보다는 상위 뷰컨트롤러 찾아서 passing하는 방법을 보고 공유했던거라 ㅋㅋㅋㅋ 밑에 메소드를 제대로 안봤었네용
그치만 datapass 메소드를 분리하는 방법이 의도가 명확해서 그렇게 해도 좋을 것 같습니다!

viewController?.navigationController?.pushViewController(playbackViewController, animated: true)
}
Expand Down
Loading
Loading