Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/mash-up-kr/HikingClub_iOS
Browse files Browse the repository at this point in the history
…into feature/ns/searchTab
  • Loading branch information
namsoo5 committed Nov 5, 2021
2 parents 5159bbf + 4f42192 commit 7b5a177
Show file tree
Hide file tree
Showing 23 changed files with 197 additions and 7 deletions.
8 changes: 8 additions & 0 deletions HikingClub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
067DC4FB26FF19DE00650862 /* API.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067DC4FA26FF19DE00650862 /* API.swift */; };
067DC4FF26FF213400650862 /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067DC4FE26FF213400650862 /* NetworkError.swift */; };
067DC50126FF238F00650862 /* NetworkLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067DC50026FF238F00650862 /* NetworkLogging.swift */; };
0684EA5B2734623300FC74D1 /* UITableViewCell+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0684EA5A2734623300FC74D1 /* UITableViewCell+.swift */; };
06962E902727FC250021402F /* NDTabButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06962E8F2727FC250021402F /* NDTabButton.swift */; };
06962E93272927770021402F /* SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06962E92272927770021402F /* SearchViewController.swift */; };
06962E95272927A00021402F /* Search.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 06962E94272927A00021402F /* Search.storyboard */; };
Expand All @@ -39,6 +40,7 @@
06A1ECB5271952B100EA78D8 /* NDTextFieldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06A1ECB4271952B100EA78D8 /* NDTextFieldView.swift */; };
06A1ECB7271967E600EA78D8 /* ComponentTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06A1ECB6271967E600EA78D8 /* ComponentTestViewController.swift */; };
06A1ECB927198ED200EA78D8 /* UITextField+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06A1ECB827198ED200EA78D8 /* UITextField+.swift */; };
06AB8CB827312461007F32AA /* RxTextFieldDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06AB8CB727312461007F32AA /* RxTextFieldDelegateProxy.swift */; };
06B68F9727228FF9007174E1 /* NDSearchTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06B68F9627228FF9007174E1 /* NDSearchTextField.swift */; };
06BC1F74271C1B79001A6584 /* NDAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06BC1F73271C1B79001A6584 /* NDAlert.swift */; };
283AF0502708672C0033ED71 /* Home.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 283AF04F2708672C0033ED71 /* Home.storyboard */; };
Expand Down Expand Up @@ -111,6 +113,7 @@
067DC4FA26FF19DE00650862 /* API.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = API.swift; sourceTree = "<group>"; };
067DC4FE26FF213400650862 /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = "<group>"; };
067DC50026FF238F00650862 /* NetworkLogging.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkLogging.swift; sourceTree = "<group>"; };
0684EA5A2734623300FC74D1 /* UITableViewCell+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+.swift"; sourceTree = "<group>"; };
06962E8F2727FC250021402F /* NDTabButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NDTabButton.swift; sourceTree = "<group>"; };
06962E92272927770021402F /* SearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewController.swift; sourceTree = "<group>"; };
06962E94272927A00021402F /* Search.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Search.storyboard; sourceTree = "<group>"; };
Expand All @@ -136,6 +139,7 @@
06A1ECB4271952B100EA78D8 /* NDTextFieldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NDTextFieldView.swift; sourceTree = "<group>"; };
06A1ECB6271967E600EA78D8 /* ComponentTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComponentTestViewController.swift; sourceTree = "<group>"; };
06A1ECB827198ED200EA78D8 /* UITextField+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField+.swift"; sourceTree = "<group>"; };
06AB8CB727312461007F32AA /* RxTextFieldDelegateProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RxTextFieldDelegateProxy.swift; sourceTree = "<group>"; };
06B68F9627228FF9007174E1 /* NDSearchTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NDSearchTextField.swift; sourceTree = "<group>"; };
06BC1F73271C1B79001A6584 /* NDAlert.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NDAlert.swift; sourceTree = "<group>"; };
283AF04F2708672C0033ED71 /* Home.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Home.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -261,6 +265,7 @@
773C1D8F2718562A001AB7EB /* UIStoryBoard+.swift */,
775B95AB27204D1C004D4540 /* UITabBarItem+.swift */,
7760CA95272541D0006B39A9 /* Encodable+.swift */,
0684EA5A2734623300FC74D1 /* UITableViewCell+.swift */,
);
path = Extension;
sourceTree = "<group>";
Expand All @@ -275,6 +280,7 @@
06BC1F73271C1B79001A6584 /* NDAlert.swift */,
064A960E272185F900939AD5 /* NDToastView.swift */,
06B68F9627228FF9007174E1 /* NDSearchTextField.swift */,
06AB8CB727312461007F32AA /* RxTextFieldDelegateProxy.swift */,
06962E8F2727FC250021402F /* NDTabButton.swift */,
77C69BEA272CD4E6004C2207 /* KeyboardAccessoryToolbar.swift */,
);
Expand Down Expand Up @@ -753,10 +759,12 @@
06A1ECAC2711828900EA78D8 /* UIColor+.swift in Sources */,
77C69BE727294613004C2207 /* SignUpViewModel.swift in Sources */,
77213CF82708EF1600994C9A /* BaseWebView.swift in Sources */,
06AB8CB827312461007F32AA /* RxTextFieldDelegateProxy.swift in Sources */,
7760CA942725411E006B39A9 /* PlaceRequestModel.swift in Sources */,
067DC4FB26FF19DE00650862 /* API.swift in Sources */,
064A960F272185F900939AD5 /* NDToastView.swift in Sources */,
7760CA9B27259C24006B39A9 /* ResponseModel.swift in Sources */,
0684EA5B2734623300FC74D1 /* UITableViewCell+.swift in Sources */,
775B95AA271F110A004D4540 /* UIImageView+.swift in Sources */,
777B5169271197B800299430 /* UIView+.swift in Sources */,
);
Expand Down
23 changes: 22 additions & 1 deletion HikingClub/Helper/Components/ComponentTestViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ final class ComponentTestViewController: UIViewController, UIScrollViewDelegate
testToast()
testSearchTextField()
testTabButton()
naviBar()
}

func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
Expand All @@ -72,6 +73,7 @@ final class ComponentTestViewController: UIViewController, UIScrollViewDelegate
}

func testTextField() {
ndTextFieldView.rx.setDelegate(self).disposed(by: disposeBag)
ndTextFieldView.setPlaceholder("플레이스 홀더")
ndTextFieldView.setTitle("히히", description: "설명", theme: .normal)
ndTextFieldView.setTitle("워닝히히", description: "워닝설명", theme: .warning)
Expand Down Expand Up @@ -118,7 +120,7 @@ final class ComponentTestViewController: UIViewController, UIScrollViewDelegate
toastButton.setTitle("토스트띄우기", for: .normal)
toastButton.setTitleColor(.black, for: .normal)
toastButton.rx.tap
.map { .green(text: "테스트 토스트!") }
.map { .red(text: "테스트 토스트!") }
.bind(to: NDToastView.shared.rx.showText)
.disposed(by: disposeBag)

Expand All @@ -129,6 +131,8 @@ final class ComponentTestViewController: UIViewController, UIScrollViewDelegate

func testSearchTextField() {
searchTextField.setPlaceholder("검색어를 입력하세요")
searchTextField.setReturnKeyType(.done)
searchTextField.rx.setDelegate(self).disposed(by: disposeBag)
stackView.addArrangedSubview(searchTextField)
searchTextField.snp.makeConstraints {
$0.height.equalTo(48)
Expand Down Expand Up @@ -179,5 +183,22 @@ final class ComponentTestViewController: UIViewController, UIScrollViewDelegate
let spacing = UIView()
containerView.addArrangedSubview(spacing)
}

func naviBar() {
let navi = NaviBar()
stackView.addArrangedSubviews(navi)
navi.setBackItemImage()
Observable<Int>.interval(.seconds(1), scheduler: MainScheduler.instance)
.map { "\($0)" }
.bind(to: navi.rx.title)
.disposed(by: disposeBag)
}
}

extension ComponentTestViewController: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
print(textField.text!)
return true
}
}
#endif
12 changes: 12 additions & 0 deletions HikingClub/Helper/Components/NDSearchTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ final class NDSearchTextField: CodeBasedView {
func setPlaceholder(_ placeholder: String) {
textField.placeholder = placeholder
}

func setReturnKeyType(_ type: UIReturnKeyType) {
textField.returnKeyType = type
}
}

extension Reactive where Base: NDSearchTextField {
Expand All @@ -109,3 +113,11 @@ extension Reactive where Base: NDSearchTextField {
}
}
}

extension Reactive where Base: NDSearchTextField {
func setDelegate(_ delegate: UITextFieldDelegate) -> Disposable {
RxTextFieldDelegateProxy.installForwardDelegate(delegate,
retainDelegate: false,
onProxyForObject: base.textField)
}
}
21 changes: 17 additions & 4 deletions HikingClub/Helper/Components/NDTabButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ final class NDTabButton: CodeBasedView {
}()
private let titleLabel: UILabel = UILabel()
private let subTitleLabel: UILabel = UILabel()
private var isSelected: Bool = false
private var isSelected: Bool = false {
didSet {
setSelected()
tapHandler?(isSelected)
}
}
private var isEnabled: Bool = true
/// tap할때 isSelected를 넘겨주는 클로져
var tapHandler: ((Bool) -> Void)?

Expand Down Expand Up @@ -72,14 +78,21 @@ final class NDTabButton: CodeBasedView {
}
}

private func toggle() {
func toggle() {
isSelected = !isSelected
setSelected()
}

func setEnabledTouch(_ isEnabled: Bool) {
self.isEnabled = isEnabled
}

func setSelected(_ isSelected: Bool) {
self.isSelected = isSelected
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
guard isEnabled else { return }
toggle()
tapHandler?(isSelected)
}
}
12 changes: 12 additions & 0 deletions HikingClub/Helper/Components/NDTextFieldView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ final class NDTextFieldView: UIView {
func setPasswordMode() {
textField.isSecureTextEntry = true
}

func setReturnKeyType(_ type: UIReturnKeyType) {
textField.returnKeyType = type
}
}

// MARK: - Rx
Expand All @@ -167,3 +171,11 @@ extension Reactive where Base: NDTextFieldView {
}
}
}

extension Reactive where Base: NDTextFieldView {
func setDelegate(_ delegate: UITextFieldDelegate) -> Disposable {
RxTextFieldDelegateProxy.installForwardDelegate(delegate,
retainDelegate: false,
onProxyForObject: base.textField)
}
}
4 changes: 2 additions & 2 deletions HikingClub/Helper/Components/NDToastView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ final class NDToastView: UIView, CodeBasedProtocol {
titleLabel.setFont(.semiBold16)
titleLabel.textColor = .white
iconImageView.layer.cornerRadius = 12
iconImageView.backgroundColor = .white
layer.cornerRadius = 8
}

Expand All @@ -62,12 +63,11 @@ final class NDToastView: UIView, CodeBasedProtocol {
switch theme {
case let .green(text):
backgroundColor = .green500
iconImageView.backgroundColor = .white
iconImageView.setImage(.icon_check_green500_24)
titleLabel.text = text
case let .red(text):
backgroundColor = .red500
iconImageView.image = UIImage(named: "Pin")
iconImageView.setImage(.icon_exclamation_red500_24)
titleLabel.text = text
}
}
Expand Down
4 changes: 4 additions & 0 deletions HikingClub/Helper/Components/NaviBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@ extension Reactive where Base: NaviBar {
var tapRightItem: ControlEvent<Void> {
base.rightButton.rx.tap
}

var title: Binder<String> {
Binder(base) { $0.setTitle($1) }
}
}
26 changes: 26 additions & 0 deletions HikingClub/Helper/Components/RxTextFieldDelegateProxy.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// RxTextFieldDelegateProxy.swift
// HikingClub
//
// Created by 남수김 on 2021/11/02.
//

import UIKit
import RxCocoa
import RxSwift

final class RxTextFieldDelegateProxy: DelegateProxy<UITextField, UITextFieldDelegate>, DelegateProxyType, UITextFieldDelegate {
static func registerKnownImplementations() {
self.register { textField -> RxTextFieldDelegateProxy in
RxTextFieldDelegateProxy(parentObject: textField, delegateProxy: self)
}
}

static func currentDelegate(for object: UITextField) -> UITextFieldDelegate? {
return object.delegate
}

static func setCurrentDelegate(_ delegate: UITextFieldDelegate?, to object: UITextField) {
object.delegate = delegate
}
}
20 changes: 20 additions & 0 deletions HikingClub/Helper/Extension/UITableViewCell+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// UITableViewCell+.swift
// HikingClub
//
// Created by 남수김 on 2021/11/05.
//

import UIKit

extension UITableViewCell {
func selectedColor(_ color: UIColor) {
let selectView: UIView = {
let view = UIView()
view.backgroundColor = color
return view
}()
selectionStyle = .default
selectedBackgroundView = selectView
}
}
2 changes: 2 additions & 0 deletions HikingClub/SupportingFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down
3 changes: 3 additions & 0 deletions HikingClub/SupportingFiles/Resource/AssetImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ enum AssetImage: String {
case icon_trashCan_gray900_24
case icon_footprint_green500_16
case icon_location_green500_16
case icon_camera_gray500_28
case icon_threeLines_horizon_gray400_24
case icon_threeLines_horizon_gray900_24

// MARK: - tabbar

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icon_camera_gray500_28.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icon_threeLines_horizon_gray400_24.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icon_threeLines_horizon_gray900_24.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7b5a177

Please sign in to comment.