diff --git a/iOS/Ringo/Ringo.xcodeproj/project.pbxproj b/iOS/Ringo/Ringo.xcodeproj/project.pbxproj index 3ff4811..3825fa0 100644 --- a/iOS/Ringo/Ringo.xcodeproj/project.pbxproj +++ b/iOS/Ringo/Ringo.xcodeproj/project.pbxproj @@ -11,6 +11,8 @@ 945603152B6AC22A002F4B33 /* ContactsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945603142B6AC22A002F4B33 /* ContactsViewController.swift */; }; 945603172B6AC2D3002F4B33 /* RecentsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945603162B6AC2D3002F4B33 /* RecentsViewController.swift */; }; 945603192B6AC365002F4B33 /* AccountViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945603182B6AC365002F4B33 /* AccountViewController.swift */; }; + 9456031B2B6BD40B002F4B33 /* ContactsNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9456031A2B6BD40B002F4B33 /* ContactsNavigationController.swift */; }; + 9456031D2B6BF44A002F4B33 /* FriendRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9456031C2B6BF44A002F4B33 /* FriendRequestViewController.swift */; }; 945CF97B2B67E1CD00396E4E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945CF97A2B67E1CD00396E4E /* AppDelegate.swift */; }; 945CF97D2B67E1CD00396E4E /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945CF97C2B67E1CD00396E4E /* SceneDelegate.swift */; }; 945CF97F2B67E1CD00396E4E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945CF97E2B67E1CD00396E4E /* ViewController.swift */; }; @@ -25,6 +27,8 @@ 945603142B6AC22A002F4B33 /* ContactsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsViewController.swift; sourceTree = ""; }; 945603162B6AC2D3002F4B33 /* RecentsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentsViewController.swift; sourceTree = ""; }; 945603182B6AC365002F4B33 /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = ""; }; + 9456031A2B6BD40B002F4B33 /* ContactsNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsNavigationController.swift; sourceTree = ""; }; + 9456031C2B6BF44A002F4B33 /* FriendRequestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendRequestViewController.swift; sourceTree = ""; }; 945CF9772B67E1CD00396E4E /* Ringo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Ringo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 945CF97A2B67E1CD00396E4E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 945CF97C2B67E1CD00396E4E /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -70,7 +74,9 @@ 945CF97C2B67E1CD00396E4E /* SceneDelegate.swift */, 945CF97E2B67E1CD00396E4E /* ViewController.swift */, 945603122B6AC07D002F4B33 /* TabBarViewController.swift */, + 9456031A2B6BD40B002F4B33 /* ContactsNavigationController.swift */, 945603142B6AC22A002F4B33 /* ContactsViewController.swift */, + 9456031C2B6BF44A002F4B33 /* FriendRequestViewController.swift */, 945603162B6AC2D3002F4B33 /* RecentsViewController.swift */, 945603182B6AC365002F4B33 /* AccountViewController.swift */, 945CF9832B67E1CE00396E4E /* Assets.xcassets */, @@ -157,6 +163,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9456031B2B6BD40B002F4B33 /* ContactsNavigationController.swift in Sources */, 945603132B6AC07D002F4B33 /* TabBarViewController.swift in Sources */, 945CF97F2B67E1CD00396E4E /* ViewController.swift in Sources */, 945603192B6AC365002F4B33 /* AccountViewController.swift in Sources */, @@ -164,6 +171,7 @@ 945603172B6AC2D3002F4B33 /* RecentsViewController.swift in Sources */, 945CF97D2B67E1CD00396E4E /* SceneDelegate.swift in Sources */, 945603152B6AC22A002F4B33 /* ContactsViewController.swift in Sources */, + 9456031D2B6BF44A002F4B33 /* FriendRequestViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/iOS/Ringo/Ringo.xcodeproj/project.xcworkspace/xcuserdata/jinhyuk.xcuserdatad/UserInterfaceState.xcuserstate b/iOS/Ringo/Ringo.xcodeproj/project.xcworkspace/xcuserdata/jinhyuk.xcuserdatad/UserInterfaceState.xcuserstate index 63a10e8..8582104 100644 Binary files a/iOS/Ringo/Ringo.xcodeproj/project.xcworkspace/xcuserdata/jinhyuk.xcuserdatad/UserInterfaceState.xcuserstate and b/iOS/Ringo/Ringo.xcodeproj/project.xcworkspace/xcuserdata/jinhyuk.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iOS/Ringo/Ringo/ContactsNavigationController.swift b/iOS/Ringo/Ringo/ContactsNavigationController.swift new file mode 100644 index 0000000..b013146 --- /dev/null +++ b/iOS/Ringo/Ringo/ContactsNavigationController.swift @@ -0,0 +1,48 @@ +// +// ContactsNavigationController.swift +// Ringo +// +// Created by 강진혁 on 2/1/24. +// + +import UIKit + +class ContactsNavigationController: UINavigationController { + + override func viewDidLoad() { + super.viewDidLoad() + + setViewControllers([ContactsViewController()], animated: true) + // Do any additional setup after loading the view. + } + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} +// canvas 이용하기 +import SwiftUI + +struct ContactsNavigationControllerRepresentable: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> ContactsNavigationController { + return ContactsNavigationController() + } + + func updateUIViewController(_ uiViewController: ContactsNavigationController, context: Context) { + } + + typealias UIViewControllerType = ContactsNavigationController + +} +@available(iOS 13.0.0, *) +struct ContactsNavigationViewPreview: PreviewProvider { + static var previews: some View { + ContactsNavigationControllerRepresentable().edgesIgnoringSafeArea(.all) + } +} diff --git a/iOS/Ringo/Ringo/ContactsViewController.swift b/iOS/Ringo/Ringo/ContactsViewController.swift index f58c4fc..502c27f 100644 --- a/iOS/Ringo/Ringo/ContactsViewController.swift +++ b/iOS/Ringo/Ringo/ContactsViewController.swift @@ -6,14 +6,53 @@ // import UIKit +import SnapKit -class ContactsViewController: UIViewController { +class ContactsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { + + let randomNames = ["민준", "서준", "예준", "도윤", "시우", "주원", "하준", "지호", "지후", "준서", "준우", "현우", "도현", "지훈", "건우", "우진", "선우", "서진", "민재", "현준", "연우", "유준", "정우", "승우", "승현", "시윤", "준혁", "은우", "지환", "승민", "지우", "유찬", "윤우", "민성", "준영", "시후", "진우", "지수", "서연", "서윤", "지우", "서현", "민서", "하은", "하윤", "윤서", "지유", "지민", "채원", "지윤", "은서", "수아", "다은", "예은", "지아", "수빈", "소율", "예린", "예원", "지원", "소윤", "지안", "하린", "시은", "유진", "채은"] + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return randomNames.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) + cell.textLabel?.text = randomNames[indexPath.row] + + return cell + } + + let searchController = UISearchController() + var tableView: UITableView! + override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = .red - // Do any additional setup after loading the view. + view.backgroundColor = .white + +// navigationItem.largeTitleDisplayMode = .inline + + //navigation + self.navigationItem.title = "Contacts" + self.navigationController?.navigationBar.prefersLargeTitles = true + self.navigationItem.searchController = searchController + self.navigationItem.hidesSearchBarWhenScrolling = false + self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(systemName: "person.badge.plus"), style: .plain, target: self, action: #selector(requestFriend)) + + //table + tableView = UITableView(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: self.view.bounds.height)) + tableView.register(UITableViewCell.self, forCellReuseIdentifier: "Cell") + tableView.delegate = self + tableView.dataSource = self + self.view.addSubview(tableView) + + } + + //navigaion rightBtn action + @objc private func requestFriend(_ sender: UIBarButtonItem) { + self.navigationController?.pushViewController(FriendRequestViewController(), animated: true) } @@ -28,3 +67,23 @@ class ContactsViewController: UIViewController { */ } +// canvas 이용하기 +import SwiftUI + +struct ContactsViewControllerRepresentable: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> ContactsViewController { + return ContactsViewController() + } + + func updateUIViewController(_ uiViewController: ContactsViewController, context: Context) { + } + + typealias UIViewControllerType = ContactsViewController + +} +@available(iOS 13.0.0, *) +struct ContactsViewPreview: PreviewProvider { + static var previews: some View { + ContactsViewControllerRepresentable().edgesIgnoringSafeArea(.all) + } +} diff --git a/iOS/Ringo/Ringo/FriendRequestViewController.swift b/iOS/Ringo/Ringo/FriendRequestViewController.swift new file mode 100644 index 0000000..7e38787 --- /dev/null +++ b/iOS/Ringo/Ringo/FriendRequestViewController.swift @@ -0,0 +1,33 @@ +// +// FriendRequestViewController.swift +// Ringo +// +// Created by 강진혁 on 2/2/24. +// + +import UIKit + +class FriendRequestViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = .brown + + self.navigationItem.title = "Request Friend" + self.navigationItem.largeTitleDisplayMode = .never + // Do any additional setup after loading the view. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/iOS/Ringo/Ringo/TabBarViewController.swift b/iOS/Ringo/Ringo/TabBarViewController.swift index c733048..249d3ea 100644 --- a/iOS/Ringo/Ringo/TabBarViewController.swift +++ b/iOS/Ringo/Ringo/TabBarViewController.swift @@ -13,19 +13,38 @@ class TabBarViewController: UITabBarController{ override func viewDidLoad() { super.viewDidLoad() - let contactsVC = UINavigationController(rootViewController: ContactsViewController()) + tabBar.backgroundColor = .init(white: 1, alpha: 0.8) + +// let contactsVC = UINavigationController(rootViewController: ContactsViewController()) + let contactsVC = ContactsNavigationController() let recentsVC = RecentsViewController() let accountVC = AccountViewController() - contactsVC.title = "Contacts" - recentsVC.title = "Recents" - accountVC.title = "Account" - - contactsVC.tabBarItem.image = UIImage(systemName: "person.3") - recentsVC.tabBarItem.image = UIImage(systemName: "clock") - accountVC.tabBarItem.image = UIImage(systemName: "person.text.rectangle") + contactsVC.tabBarItem = UITabBarItem(title: "Contacts", image: UIImage(systemName: "person.3"), tag: 1) + recentsVC.tabBarItem = UITabBarItem(title: "Recents", image: UIImage(systemName: "clock"), tag: 2) + accountVC.tabBarItem = UITabBarItem(title: "Account", image: UIImage(systemName: "person.text.rectangle"), tag: 3) - setViewControllers([contactsVC,recentsVC,accountVC], animated: true) + setViewControllers([contactsVC,recentsVC,accountVC], animated: false) + } +} + +// canvas 이용하기 +import SwiftUI + +struct TabBarViewControllerRepresentable: UIViewControllerRepresentable { + func makeUIViewController(context: Context) -> TabBarViewController { + return TabBarViewController() } + func updateUIViewController(_ uiViewController: TabBarViewController, context: Context) { + } + + typealias UIViewControllerType = TabBarViewController + +} +@available(iOS 13.0.0, *) +struct TabBarViewPreview: PreviewProvider { + static var previews: some View { + TabBarViewControllerRepresentable().edgesIgnoringSafeArea(.all) + } }