Skip to content
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

Ringo-65 친구목록 UI 구현 #12

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions iOS/Ringo/Ringo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
945603132B6AC07D002F4B33 /* TabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945603122B6AC07D002F4B33 /* TabBarViewController.swift */; };
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 */; };
Expand All @@ -17,6 +23,12 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
945603122B6AC07D002F4B33 /* TabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarViewController.swift; sourceTree = "<group>"; };
945603142B6AC22A002F4B33 /* ContactsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsViewController.swift; sourceTree = "<group>"; };
945603162B6AC2D3002F4B33 /* RecentsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentsViewController.swift; sourceTree = "<group>"; };
945603182B6AC365002F4B33 /* AccountViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountViewController.swift; sourceTree = "<group>"; };
9456031A2B6BD40B002F4B33 /* ContactsNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsNavigationController.swift; sourceTree = "<group>"; };
9456031C2B6BF44A002F4B33 /* FriendRequestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FriendRequestViewController.swift; sourceTree = "<group>"; };
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 = "<group>"; };
945CF97C2B67E1CD00396E4E /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -61,6 +73,12 @@
945CF97A2B67E1CD00396E4E /* AppDelegate.swift */,
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 */,
945CF9852B67E1CE00396E4E /* LaunchScreen.storyboard */,
945CF9882B67E1CE00396E4E /* Info.plist */,
Expand Down Expand Up @@ -145,9 +163,15 @@
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 */,
945CF97B2B67E1CD00396E4E /* AppDelegate.swift in Sources */,
945603172B6AC2D3002F4B33 /* RecentsViewController.swift in Sources */,
945CF97D2B67E1CD00396E4E /* SceneDelegate.swift in Sources */,
945603152B6AC22A002F4B33 /* ContactsViewController.swift in Sources */,
9456031D2B6BF44A002F4B33 /* FriendRequestViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file not shown.
30 changes: 30 additions & 0 deletions iOS/Ringo/Ringo/AccountViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// AccountViewController.swift
// Ringo
//
// Created by 강진혁 on 2/1/24.
//

import UIKit

class AccountViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .blue
// 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.
}
*/

}
48 changes: 48 additions & 0 deletions iOS/Ringo/Ringo/ContactsNavigationController.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
89 changes: 89 additions & 0 deletions iOS/Ringo/Ringo/ContactsViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
//
// ContactsViewController.swift
// Ringo
//
// Created by 강진혁 on 2/1/24.
//

import UIKit
import SnapKit

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 = .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)
}


/*
// 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 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)
}
}
33 changes: 33 additions & 0 deletions iOS/Ringo/Ringo/FriendRequestViewController.swift
Original file line number Diff line number Diff line change
@@ -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.
}
*/

}
30 changes: 30 additions & 0 deletions iOS/Ringo/Ringo/RecentsViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// RecentsViewController.swift
// Ringo
//
// Created by 강진혁 on 2/1/24.
//

import UIKit

class RecentsViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .green
// 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.
}
*/

}
2 changes: 1 addition & 1 deletion iOS/Ringo/Ringo/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
let mainViewController = ViewController()
let mainViewController = TabBarViewController()

window?.rootViewController = mainViewController
window?.makeKeyAndVisible()
Expand Down
50 changes: 50 additions & 0 deletions iOS/Ringo/Ringo/TabBarViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// TabBarViewController.swift
// Ringo
//
// Created by 강진혁 on 2/1/24.
//

import UIKit
import SnapKit

class TabBarViewController: UITabBarController{

override func viewDidLoad() {
super.viewDidLoad()

tabBar.backgroundColor = .init(white: 1, alpha: 0.8)

// let contactsVC = UINavigationController(rootViewController: ContactsViewController())
let contactsVC = ContactsNavigationController()
let recentsVC = RecentsViewController()
let accountVC = AccountViewController()

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: 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)
}
}
2 changes: 1 addition & 1 deletion iOS/Ringo/Ringo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct ViewPreview: PreviewProvider {
ViewControllerRepresentable().edgesIgnoringSafeArea(.all)
}
}

// hexcode로 색 지정하기
extension UIColor {

convenience init(hexCode: String, alpha: CGFloat = 1.0) {
Expand Down