-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] #467 - 회원가입 UI 구현
- Loading branch information
Showing
54 changed files
with
1,624 additions
and
176 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
SOPT-iOS/Projects/Core/Sources/Extension/Combine+/Publisher+WithLatestFrom.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// | ||
// Publisher+WithLatestFrom.swift | ||
// Core | ||
// | ||
// Created by 장석우 on 1/9/25. | ||
// Copyright © 2025 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Combine | ||
|
||
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) | ||
extension Publishers { | ||
|
||
public struct WithLatestFrom<Upstream, Other> : Publisher where Upstream : Publisher, Other: Publisher, Upstream.Failure == Other.Failure { | ||
|
||
public typealias Output = Other.Output | ||
public typealias Failure = Upstream.Failure | ||
|
||
public let upstream: Upstream | ||
public let other: Other | ||
|
||
public init(upstream: Upstream, other: Other) { | ||
self.upstream = upstream | ||
self.other = other | ||
} | ||
|
||
public func receive<S>(subscriber: S) where S : Subscriber, Self.Output == S.Input, Self.Failure == S.Failure { | ||
let merged = mergeStream(upstream, other) | ||
let result = resultStream(from: merged) | ||
result.subscribe(subscriber) | ||
} | ||
} | ||
} | ||
|
||
extension Publishers.WithLatestFrom { | ||
|
||
enum MergedOutput { | ||
case upstream(Upstream.Output) | ||
case other(Other.Output) | ||
} | ||
|
||
typealias ScanResult = (upstream: Upstream.Output?, other: Other.Output?, shouldEmit: Bool) | ||
|
||
func mergeStream(_ upstream: Upstream, _ other: Other) -> AnyPublisher<MergedOutput, Failure> { | ||
let upstream = upstream.map { MergedOutput.upstream($0)} | ||
let other = other.map { MergedOutput.other($0)} | ||
return Publishers.Merge(upstream, other).eraseToAnyPublisher() | ||
} | ||
|
||
func resultStream(from mergedStream: AnyPublisher<MergedOutput, Failure>) -> AnyPublisher<Output, Failure> { | ||
mergedStream | ||
.scan(nil) { result, mergedOutput -> ScanResult? in | ||
var upstream: Upstream.Output? | ||
var other: Other.Output? | ||
let shouldEmit: Bool | ||
|
||
switch mergedOutput { | ||
case let .upstream(output): | ||
upstream = output | ||
shouldEmit = result?.other != nil | ||
|
||
case let .other(output): | ||
other = output | ||
shouldEmit = false | ||
} | ||
|
||
return ScanResult( | ||
upstream: upstream ?? result?.upstream, | ||
other: other ?? result?.other, | ||
shouldEmit: shouldEmit | ||
) | ||
} | ||
.compactMap { $0 } | ||
.filter { $0.shouldEmit } | ||
.compactMap { $0.other } | ||
.eraseToAnyPublisher() | ||
} | ||
} | ||
|
||
extension Publisher { | ||
public func withLatestFrom<P>(_ other: P) -> Publishers.WithLatestFrom<Self, P> where P : Publisher, Self.Failure == P.Failure { | ||
return .init(upstream: self, other: other) | ||
} | ||
} | ||
|
||
|
19 changes: 19 additions & 0 deletions
19
SOPT-iOS/Projects/Core/Sources/Extension/Foundation+/Int+.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// Int+.swift | ||
// Core | ||
// | ||
// Created by 장석우 on 1/6/25. | ||
// Copyright © 2025 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
extension Int { | ||
|
||
public var to_mmss: String { | ||
// let hours = Int(self) / 3600 | ||
let minutes = Int(self) / 60 % 60 | ||
let seconds = Int(self) % 60 | ||
return String(format: "%02i:%02i", minutes, seconds) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
SOPT-iOS/Projects/Domain/Sources/UseCase/SignUpUseCase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// SignUpUseCase.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 1/4/25. | ||
// Copyright © 2025 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public protocol SignUpUseCase { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
SOPT-iOS/Projects/Features/AuthFeature/Interface/Sources/SignUpPhoneVerifyPresentable.swift
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
SOPT-iOS/Projects/Features/AuthFeature/Interface/Sources/SignUpPresentable.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// SignUpPhoneVerifyViewControllable.swift | ||
// AuthFeature | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import BaseFeatureDependency | ||
import Core | ||
import Domain | ||
|
||
public protocol SignUpViewControllable: ViewControllable {} | ||
|
||
public protocol SignUpCoordinatable { | ||
var onLoginHelpButtonTapped: (() -> Void)? { get set } | ||
} | ||
|
||
public typealias PhoneVerifyViewModelType = ViewModelType | ||
|
||
public typealias SignUpViewModelType = ViewModelType & SignUpCoordinatable | ||
|
||
public typealias SignUpPresentable = (vc: SignUpViewControllable, vm: any SignUpViewModelType) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.