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

Feature/#6 MVVM Refectoring #7

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
92 changes: 52 additions & 40 deletions Kakao_MVVM/Kakao_MVVM.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,27 @@
"identity" : "alamofire",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Alamofire/Alamofire.git",
"state" : {
"revision" : "78424be314842833c04bc3bef5b72e85fff99204",
"version" : "5.6.4"
}
},
{
"identity" : "moya",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Moya/Moya",
"state" : {
"branch" : "master",
"revision" : "bdecb2c87a21a236dcfe88b21532ad3f0e3d20f4"
"revision" : "77e67c0b25ebd785c6fe56cad544885f67c8c2c4"
}
},
{
"identity" : "reactiveswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ReactiveCocoa/ReactiveSwift.git",
"state" : {
"revision" : "c43bae3dac73fdd3cb906bd5a1914686ca71ed3c",
"version" : "6.7.0"
}
},
{
Expand Down
35 changes: 15 additions & 20 deletions Kakao_MVVM/Kakao_MVVM/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,24 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let _ = (scene as? UIWindowScene) else { return }

guard let _ = (scene as? UIWindowScene) else { return }
if let windowScene = scene as? UIWindowScene {

let window = UIWindow(windowScene: windowScene)
window.overrideUserInterfaceStyle = UIUserInterfaceStyle.light

// let rootVC = FriendViewController()
// let navigationController = UINavigationController(rootViewController: rootVC)

if let windowScene = scene as? UIWindowScene {

let window = UIWindow(windowScene: windowScene)
window.overrideUserInterfaceStyle = UIUserInterfaceStyle.light

let rootVC = FriendViewController()
let navigationController = UINavigationController(rootViewController: rootVC)

let mainVC = MainTabBarController()

window.rootViewController = mainVC
window.makeKeyAndVisible()
self.window = window
}
let mainVC = MainTabBarController()
window.rootViewController = mainVC
window.makeKeyAndVisible()
self.window = window
}

}
func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
// This occurs shortly after the scene enters the background, or when its session is discarded.
Expand Down
39 changes: 0 additions & 39 deletions Kakao_MVVM/Kakao_MVVM/Global/Extensions/Extensions +.swift

This file was deleted.

8 changes: 8 additions & 0 deletions Kakao_MVVM/Kakao_MVVM/Global/Extensions/Int +.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// Int +.swift
// Kakao_MVVM
//
// Created by Mac Book Pro on 2022/11/17.
//

import Foundation
17 changes: 17 additions & 0 deletions Kakao_MVVM/Kakao_MVVM/Global/Extensions/NSObject +.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NSObject +.swift
// Kakao_MVVM
//
// Created by Mac Book Pro on 2022/11/17.
//

import Foundation

extension NSObject {
static var className: String {
NSStringFromClass(self.classForCoder()).components(separatedBy: ".").last!
}
var className: String {
NSStringFromClass(self.classForCoder).components(separatedBy: ".").last!
}
}
19 changes: 19 additions & 0 deletions Kakao_MVVM/Kakao_MVVM/Global/Extensions/UIButton +.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// UIButton +.swift
// Kakao_MVVM
//
// Created by Mac Book Pro on 2022/11/17.
//

import Foundation
import UIKit

extension UIButton {
public func configureButton(title : String){
self.setTitle(title, for: .normal)
self.setTitleColor(.black, for: .normal)
self.titleLabel?.textAlignment = .center
self.backgroundColor = .systemGray6
self.layer.cornerRadius = 5
}
}
32 changes: 25 additions & 7 deletions Kakao_MVVM/Kakao_MVVM/Global/Extensions/UICollectionView +.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,30 @@
import Foundation
import UIKit

extension UICollectionViewCell: ReusableView {}
//extension UICollectionViewCell: ReusableView {}
//
//extension UICollectionView{
// func register<T: UICollectionViewCell>(_ cellClass: T.Type){
// let identifier = T.identifier
// self.register(T.self, forCellWithReuseIdentifier: identifier)
// }
//}


extension UICollectionView{
func register<T: UICollectionViewCell>(_ cellClass: T.Type){
let identifier = T.identifier
self.register(T.self, forCellWithReuseIdentifier: identifier)
}
}
protocol UICollectionViewRegisterable {
static var isFromNib: Bool { get }
static func register(target: UITableView)
}

extension UICollectionViewRegisterable where Self: UICollectionViewCell {
static func register(target: UICollectionView) {
target.register(Self.self, forCellWithReuseIdentifier: Self.className)
/*
if self.isFromNib {
target.register(UINib(nibName: Self.className, bundle: nil), forCellWithReuseIdentifier: Self.className)
} else {
target.register(Self.self, forCellWithReuseIdentifier: Self.className)
}
*/
}
}
23 changes: 16 additions & 7 deletions Kakao_MVVM/Kakao_MVVM/Global/Extensions/UITableView +.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@
import Foundation
import UIKit

extension UITableViewCell: ReusableView {}

extension UITableView{
func register<T: UITableViewCell>(_ cellClass: T.Type){
let identifier = T.identifier
self.register(T.self, forCellReuseIdentifier: identifier)
}
}
protocol UITableViewRegisterable {
static var isFromNib: Bool { get }
static func register(target: UITableView)
}

extension UITableViewRegisterable where Self: UITableViewCell {
static func register(target: UITableView) {
target.register(Self.self, forCellReuseIdentifier: Self.className)
/*
if self.isFromNib {
target.register(UINib(nibName: Self.className, bundle: nil), forCellReuseIdentifier: Self.className)
} else {
target.register(Self.self, forCellReuseIdentifier: Self.className)
}
*/
}
}
62 changes: 62 additions & 0 deletions Kakao_MVVM/Kakao_MVVM/Global/NameSpace/ImageName.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// ImageName.swift
// SOPT-Assignment-KAKAO
//
// Created by Mac Book Pro on 2022/10/24.
//

import UIKit

public enum Image{
public static let defaultProfileImage = UIImage(named: "profileImage")
public static let profileMessageButtonImg = UIImage(systemName: "message.fill")
public static let profileStoryButtonImg = UIImage(named: "profileStoryImg")
public static let profileEditButtonImg = UIImage(named: "profileEditImg")

public static let settingButtonImage = UIImage(systemName: "gearshape")
public static let plusButtonImage = UIImage(systemName: "plus")
public static let closeButtonImage = UIImage(systemName: "xmark")


public static let chattingBannerImg = UIImage(named: "chattingBannerImg")
public static let profileImg = [
UIImage(named: "profileImage1"),
UIImage(named: "profileImage2"),
UIImage(named: "profileImage3"),
UIImage(named: "profileImage4"),
UIImage(named: "profileImage5"),
UIImage(named: "profileImage6"),
UIImage(named: "profileImage7"),
UIImage(named: "profileImage8"),
UIImage(named: "profileImage9"),
]


public static let selectPhotoImage = UIImage(systemName: "camera.fill", withConfiguration: UIImage.SymbolConfiguration(pointSize: 15))
public static let defaultPhotoImage = UIImage(systemName: "photo.fill")
public static let photoImage = [
UIImage(named: "galleryImage1"),
UIImage(named: "galleryImage2"),
UIImage(named: "galleryImage3"),
UIImage(named: "galleryImage4"),
UIImage(named: "galleryImage5"),
UIImage(named: "galleryImage6"),
UIImage(named: "galleryImage7"),
UIImage(named: "galleryImage8"),
UIImage(named: "galleryImage9"),
UIImage(named: "galleryImage10"),
UIImage(named: "galleryImage11"),
UIImage(named: "galleryImage12"),
UIImage(named: "galleryImage13"),
UIImage(named: "galleryImage14"),
UIImage(named: "galleryImage15"),
UIImage(named: "galleryImage16"),
UIImage(named: "galleryImage17"),
UIImage(named: "galleryImage18"),
UIImage(named: "galleryImage19"),
UIImage(named: "galleryImage20"),
UIImage(named: "galleryImage21"),
UIImage(named: "galleryImage22"),
UIImage(named: "galleryImage23")
]
}
14 changes: 7 additions & 7 deletions Kakao_MVVM/Kakao_MVVM/Global/Resources/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_0" orientation="portrait" appearance="light"/>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Friend View Controller-->
<!--View Controller-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController id="Y6W-OH-hqX" customClass="FriendViewController" customModule="Kakao_MVVM" customModuleProvider="target" sceneMemberID="viewController">
<viewController storyboardIdentifier="Main" id="Y6W-OH-hqX" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="390" height="844"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="129" y="4"/>
<point key="canvasLocation" x="118" y="-2"/>
</scene>
</scenes>
<resources>
Expand Down
11 changes: 9 additions & 2 deletions Kakao_MVVM/Kakao_MVVM/Model/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ struct User{
var profileImg : UIImage
var stateMessage : String


init(name : String, profileImg: UIImage = Image.defaultProfileImage!, stateMessage: String = ""){
init(name : String, profileImg: UIImage, stateMessage: String){
self.name = name
self.profileImg = profileImg
self.stateMessage = stateMessage
}

init(name: String){
self.name = name
self.profileImg = Image.defaultProfileImage!
self.stateMessage = ""
// self.init(name: name, profileImg: Image.defaultProfileImage!, stateMessage: "")
}
}


Loading