-
Notifications
You must be signed in to change notification settings - Fork 2
[Feat] 회원가입화면1의 스크롤뷰 구현과, 검색화면의 바텀시트의 드래그 기능 UI를 구현했습니다. #103
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b76bdc5
feat: 회원가입화면1 스크롤뷰 추가 - 뷰파일
snughnu 7b350c9
feat: 회원가입화면1 스크롤뷰 추가 - 뷰컨
snughnu af8ffa2
design: 검색아이콘, 마이크 이미지 에셋 추가
snughnu 3b21a4c
feat: 검색화면 - 검색텍스트필드 설정 및 추가 파일 생성
snughnu 96258e4
feat: 바텀시트 뷰, 뷰컨 작성
snughnu bf2ac4a
feat: 바텀시트 드래그 적용
snughnu 0b1b0ca
feat: 검색화면 - 마이크 버튼 UI 구현
snughnu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
6 changes: 6 additions & 0 deletions
6
Popcorn-iOS/Resource/Assets.xcassets/SearchScene/Contents.json
This file contains hidden or 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,6 @@ | ||
| { | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
Popcorn-iOS/Resource/Assets.xcassets/SearchScene/mic.imageset/Contents.json
This file contains hidden or 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" : "mic1.png", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "filename" : "mic2.png", | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "filename" : "mic3.png", | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
Binary file added
BIN
+504 Bytes
Popcorn-iOS/Resource/Assets.xcassets/SearchScene/mic.imageset/mic1.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
+787 Bytes
Popcorn-iOS/Resource/Assets.xcassets/SearchScene/mic.imageset/mic2.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
+1.12 KB
Popcorn-iOS/Resource/Assets.xcassets/SearchScene/mic.imageset/mic3.png
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
Popcorn-iOS/Resource/Assets.xcassets/SearchScene/searchIcon.imageset/Contents.json
This file contains hidden or 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" : "searchIcon1.png", | ||
| "idiom" : "universal", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "filename" : "searchIcon2.png", | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "filename" : "searchIcon3.png", | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
Binary file added
BIN
+548 Bytes
...rn-iOS/Resource/Assets.xcassets/SearchScene/searchIcon.imageset/searchIcon1.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
+987 Bytes
...rn-iOS/Resource/Assets.xcassets/SearchScene/searchIcon.imageset/searchIcon2.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
+1.37 KB
...rn-iOS/Resource/Assets.xcassets/SearchScene/searchIcon.imageset/searchIcon3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
Popcorn-iOS/Source/Presentation/Search/Common/View/SearchFilterButton.swift
This file contains hidden or 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,12 @@ | ||
| // | ||
| // SearchFilterButton.swift | ||
| // Popcorn-iOS | ||
| // | ||
| // Created by 김성훈 on 4/14/25. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| class SearchFilterButton: UIButton { | ||
|
|
||
| } |
21 changes: 21 additions & 0 deletions
21
...esentation/Search/SearchScene/Views/ViewControllers/SearchBottomSheetViewController.swift
This file contains hidden or 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,21 @@ | ||
| // | ||
| // SearchBottomSheetViewController.swift | ||
| // Popcorn-iOS | ||
| // | ||
| // Created by 김성훈 on 4/14/25. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| class SearchBottomSheetViewController: UIViewController { | ||
| // MARK: - Properties | ||
| private let searchBottomSheetView = SearchBottomSheetView() | ||
|
|
||
| override func loadView() { | ||
| view = searchBottomSheetView | ||
| } | ||
|
|
||
| override func viewDidLoad() { | ||
| super.viewDidLoad() | ||
| } | ||
| } |
97 changes: 97 additions & 0 deletions
97
...S/Source/Presentation/Search/SearchScene/Views/ViewControllers/SearchViewController.swift
This file contains hidden or 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,97 @@ | ||
| // | ||
| // SearchViewController.swift | ||
| // Popcorn-iOS | ||
| // | ||
| // Created by 김성훈 on 4/14/25. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| class SearchViewController: UIViewController { | ||
| // MARK: - Properties | ||
| private let searchView = SearchView() | ||
| private let searchBottomSheetViewController = SearchBottomSheetViewController() | ||
|
|
||
| // MARK: - Bottom Sheet Properties | ||
| private var bottomSheetTopOffsetConstraint: NSLayoutConstraint? | ||
| private var topOffsetWhenOpened: CGFloat { | ||
| return view.bounds.height * 130 / 852 | ||
| } | ||
| private var topOffsetWhenClosed: CGFloat { | ||
| return view.bounds.height * 606 / 852 | ||
| } | ||
| private var bottomSheetHeight: CGFloat { | ||
| return view.bounds.height * 668 / 852 | ||
| } | ||
| private var hasAddedBottomSheet = false | ||
|
|
||
| // MARK: - Initializer | ||
| override func loadView() { | ||
| view = searchView | ||
| } | ||
|
|
||
| override func viewDidLayoutSubviews() { | ||
| super.viewDidLayoutSubviews() | ||
| if !hasAddedBottomSheet { | ||
| hasAddedBottomSheet = true | ||
| addBottomSheet() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Bottom Sheet Methods | ||
| extension SearchViewController { | ||
| private func addBottomSheet() { | ||
| addChild(searchBottomSheetViewController) | ||
| view.addSubview(searchBottomSheetViewController.view) | ||
| searchBottomSheetViewController.didMove(toParent: self) | ||
|
|
||
| let sheetView = searchBottomSheetViewController.view! | ||
| sheetView.translatesAutoresizingMaskIntoConstraints = false | ||
|
|
||
| let top = sheetView.topAnchor.constraint( | ||
| equalTo: view.safeAreaLayoutGuide.topAnchor, | ||
| constant: topOffsetWhenClosed | ||
| ) | ||
| bottomSheetTopOffsetConstraint = top | ||
|
|
||
| NSLayoutConstraint.activate([ | ||
| top, | ||
| sheetView.leadingAnchor.constraint(equalTo: view.leadingAnchor), | ||
| sheetView.trailingAnchor.constraint(equalTo: view.trailingAnchor), | ||
| sheetView.heightAnchor.constraint(equalToConstant: bottomSheetHeight) | ||
| ]) | ||
|
|
||
| let bottomSheetPanGesture = UIPanGestureRecognizer(target: self, action: #selector(handlePan)) | ||
| sheetView.addGestureRecognizer(bottomSheetPanGesture) | ||
| } | ||
|
|
||
| @objc private func handlePan(_ gesture: UIPanGestureRecognizer) { | ||
| guard let topConstraint = bottomSheetTopOffsetConstraint else { return } | ||
| let translation = gesture.translation(in: view) | ||
| gesture.setTranslation(.zero, in: view) | ||
|
|
||
| switch gesture.state { | ||
| case .changed: | ||
| topConstraint.constant += translation.y | ||
| topConstraint.constant = max(topOffsetWhenOpened, min(topOffsetWhenClosed, topConstraint.constant)) | ||
| view.layoutIfNeeded() | ||
|
|
||
| case .ended: | ||
| let velocity = gesture.velocity(in: view).y | ||
| let mid = (topOffsetWhenClosed + topOffsetWhenOpened) / 2 | ||
| let target = (velocity > 0 || topConstraint.constant > mid) ? topOffsetWhenClosed : topOffsetWhenOpened | ||
| animateBottomSheet(to: target) | ||
|
|
||
| default: | ||
| break | ||
| } | ||
| } | ||
|
|
||
| private func animateBottomSheet(to constant: CGFloat) { | ||
| bottomSheetTopOffsetConstraint?.constant = constant | ||
| UIView.animate(withDuration: 0.25, delay: 0, options: [.curveEaseOut]) { | ||
| self.view.layoutIfNeeded() | ||
| } | ||
| } | ||
| } | ||
28 changes: 28 additions & 0 deletions
28
Popcorn-iOS/Source/Presentation/Search/SearchScene/Views/Views/SearchBottomSheetView.swift
This file contains hidden or 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,28 @@ | ||
| // | ||
| // SearchBottomSheetView.swift | ||
| // Popcorn-iOS | ||
| // | ||
| // Created by 김성훈 on 4/14/25. | ||
| // | ||
|
|
||
| import UIKit | ||
|
|
||
| class SearchBottomSheetView: UIView { | ||
| override init(frame: CGRect) { | ||
| super.init(frame: frame) | ||
| configureInitialSetting() | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Configure Initial Setting | ||
| extension SearchBottomSheetView { | ||
| private func configureInitialSetting() { | ||
| backgroundColor = UIColor(.white) | ||
| layer.cornerRadius = 10 | ||
| layer.masksToBounds = true | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.