-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
307 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
StreetDrop/StreetDrop/Presentation/MyPage/View/FilterModal/RegionCollectionViewCell.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,50 @@ | ||
// | ||
// RegionCollectionViewCell.swift | ||
// StreetDrop | ||
// | ||
// Created by 차요셉 on 8/5/24. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
|
||
final class RegionCollectionViewCell: UICollectionViewCell { | ||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
configureUI() | ||
} | ||
|
||
@available(*, unavailable) | ||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implement") | ||
} | ||
|
||
private lazy var regionNameLabel: UILabel = { | ||
let label: UILabel = .init() | ||
label.font = .pretendard(size: 16, weightName: .medium) | ||
label.setLineHeight(lineHeight: 24) | ||
label.textColor = .gray200 | ||
label.numberOfLines = 1 | ||
label.textAlignment = .center | ||
|
||
return label | ||
}() | ||
|
||
func configure(regionName: String) { | ||
regionNameLabel.text = regionName | ||
} | ||
} | ||
|
||
private extension RegionCollectionViewCell { | ||
func configureUI() { | ||
self.backgroundColor = .gray600 | ||
|
||
addSubview(regionNameLabel) | ||
|
||
regionNameLabel.snp.makeConstraints { | ||
$0.centerY.equalToSuperview() | ||
$0.horizontalEdges.equalToSuperview() | ||
} | ||
} | ||
} |
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
54 changes: 54 additions & 0 deletions
54
StreetDrop/StreetDrop/Presentation/MyPage/ViewModel/RegionFilteringModalViewModel.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,54 @@ | ||
// | ||
// RegionFilteringModalViewModel.swift | ||
// StreetDrop | ||
// | ||
// Created by 차요셉 on 7/31/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import RxSwift | ||
import RxRelay | ||
import OrderedCollections | ||
|
||
final class RegionFilteringModalViewModel: ViewModel { | ||
private let output: Output = .init() | ||
private let fetchingCityAndDistrictsUseCase: FetchingCityAndDistrictsUseCase | ||
private var cityAndDistricts: OrderedDictionary<String, [String]> = [:] | ||
|
||
init(fetchingCityAndDistrictsUseCase: FetchingCityAndDistrictsUseCase = DefaultFetchingCityAndDistrictsUseCase()) { | ||
self.fetchingCityAndDistrictsUseCase = fetchingCityAndDistrictsUseCase | ||
do { | ||
cityAndDistricts = try fetchingCityAndDistrictsUseCase.execute() | ||
} catch { | ||
output.errorAlertShowRelay.accept(error.localizedDescription) | ||
} | ||
} | ||
|
||
struct Input { | ||
let viewDidLoadEvent: Observable<Void> | ||
} | ||
|
||
struct Output { | ||
fileprivate let errorAlertShowRelay: PublishRelay<String> = .init() | ||
var errorAlertShow: Observable<String> { | ||
errorAlertShowRelay.asObservable() | ||
} | ||
|
||
fileprivate let cityNamesRelay: BehaviorRelay<[String]> = .init(value: []) | ||
var cityNames: Observable<[String]> { | ||
cityNamesRelay.asObservable() | ||
} | ||
} | ||
|
||
func convert(input: Input, disposedBag: DisposeBag) -> Output { | ||
input.viewDidLoadEvent | ||
.bind(with: self) { owner, _ in | ||
let cityNames = owner.cityAndDistricts.keys.map { String($0) } | ||
owner.output.cityNamesRelay.accept(cityNames) | ||
} | ||
.disposed(by: disposedBag) | ||
|
||
return output | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
...etDrop/StreetDrop/Resource/Assets.xcassets/arrow-right-placeholder.imageset/Contents.json
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 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "arrow-right-placeholder.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+249 Bytes
...ce/Assets.xcassets/arrow-right-placeholder.imageset/arrow-right-placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+397 Bytes
...Assets.xcassets/arrow-right-placeholder.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+431 Bytes
...Assets.xcassets/arrow-right-placeholder.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
StreetDrop/StreetDrop/Resource/Assets.xcassets/arrow-right-primary.imageset/Contents.json
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 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "arrow-right-primary.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+183 Bytes
...p/Resource/Assets.xcassets/arrow-right-primary.imageset/arrow-right-primary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+246 Bytes
...esource/Assets.xcassets/arrow-right-primary.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+258 Bytes
...esource/Assets.xcassets/arrow-right-primary.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.