Skip to content

Commit

Permalink
뷰 구현 #4
Browse files Browse the repository at this point in the history
뷰 구현
  • Loading branch information
JunseokNoh authored Jul 17, 2021
2 parents e84f8d6 + ec6ec41 commit 3057389
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 31 deletions.
20 changes: 12 additions & 8 deletions KNU_CSE/KNU_CSE.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
68F1A5C426A0088D007B4B86 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 68F1A5C226A0088D007B4B86 /* LaunchScreen.storyboard */; };
68F1A5CF26A0088D007B4B86 /* KNU_CSETests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5CE26A0088D007B4B86 /* KNU_CSETests.swift */; };
68F1A5DA26A0088D007B4B86 /* KNU_CSEUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5D926A0088D007B4B86 /* KNU_CSEUITests.swift */; };
68F1A5EC26A008FF007B4B86 /* SingUpRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5E826A008FF007B4B86 /* SingUpRequest.swift */; };
68F1A5EC26A008FF007B4B86 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5E826A008FF007B4B86 /* Request.swift */; };
68F1A5ED26A008FF007B4B86 /* GetEventListApiRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5E926A008FF007B4B86 /* GetEventListApiRequest.swift */; };
68F1A5EE26A008FF007B4B86 /* BaseObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5EA26A008FF007B4B86 /* BaseObject.swift */; };
68F1A5EF26A008FF007B4B86 /* BaseApiRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5EB26A008FF007B4B86 /* BaseApiRequest.swift */; };
Expand All @@ -24,9 +24,10 @@
68F1A5F826A0090B007B4B86 /* SignUpViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5F326A0090B007B4B86 /* SignUpViewModel.swift */; };
68F1A5F926A0090B007B4B86 /* BindingTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5F526A0090B007B4B86 /* BindingTextField.swift */; };
68F1A5FC26A01080007B4B86 /* SignInViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5FB26A01080007B4B86 /* SignInViewModel.swift */; };
68F1A5FE26A07147007B4B86 /* SignUpUiLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5FD26A07147007B4B86 /* SignUpUiLabel.swift */; };
68F1A5FE26A07147007B4B86 /* SignUpUILabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5FD26A07147007B4B86 /* SignUpUILabel.swift */; };
68F1A60026A07FE7007B4B86 /* CheckBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A5FF26A07FE7007B4B86 /* CheckBox.swift */; };
68F1A60326A0A73B007B4B86 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A60226A0A73B007B4B86 /* Color.swift */; };
68F1A60526A1598A007B4B86 /* SignInModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68F1A60426A1598A007B4B86 /* SignInModel.swift */; };
9AACC46FE6327A8A8FEE1371 /* Pods_KNU_CSE.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AEB9BE74D13DB6D6DE35FAE /* Pods_KNU_CSE.framework */; };
AE59CA79AE6C9CF423411766 /* Pods_KNU_CSE_KNU_CSEUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C3849D4B5E75A8D54F61D53 /* Pods_KNU_CSE_KNU_CSEUITests.framework */; };
B614ABCE044BEAE18AECD334 /* Pods_KNU_CSETests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7F57A9F2B8C44351C36B27DE /* Pods_KNU_CSETests.framework */; };
Expand Down Expand Up @@ -67,7 +68,7 @@
68F1A5D526A0088D007B4B86 /* KNU_CSEUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = KNU_CSEUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
68F1A5D926A0088D007B4B86 /* KNU_CSEUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KNU_CSEUITests.swift; sourceTree = "<group>"; };
68F1A5DB26A0088D007B4B86 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
68F1A5E826A008FF007B4B86 /* SingUpRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingUpRequest.swift; sourceTree = "<group>"; };
68F1A5E826A008FF007B4B86 /* Request.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Request.swift; sourceTree = "<group>"; };
68F1A5E926A008FF007B4B86 /* GetEventListApiRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GetEventListApiRequest.swift; sourceTree = "<group>"; };
68F1A5EA26A008FF007B4B86 /* BaseObject.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseObject.swift; sourceTree = "<group>"; };
68F1A5EB26A008FF007B4B86 /* BaseApiRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseApiRequest.swift; sourceTree = "<group>"; };
Expand All @@ -76,9 +77,10 @@
68F1A5F326A0090B007B4B86 /* SignUpViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignUpViewModel.swift; sourceTree = "<group>"; };
68F1A5F526A0090B007B4B86 /* BindingTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BindingTextField.swift; sourceTree = "<group>"; };
68F1A5FB26A01080007B4B86 /* SignInViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInViewModel.swift; sourceTree = "<group>"; };
68F1A5FD26A07147007B4B86 /* SignUpUiLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpUiLabel.swift; sourceTree = "<group>"; };
68F1A5FD26A07147007B4B86 /* SignUpUILabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignUpUILabel.swift; sourceTree = "<group>"; };
68F1A5FF26A07FE7007B4B86 /* CheckBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckBox.swift; sourceTree = "<group>"; };
68F1A60226A0A73B007B4B86 /* Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
68F1A60426A1598A007B4B86 /* SignInModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInModel.swift; sourceTree = "<group>"; };
7F57A9F2B8C44351C36B27DE /* Pods_KNU_CSETests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_KNU_CSETests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8A621397DE389C29CC60A0AD /* Pods-KNU_CSE.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KNU_CSE.debug.xcconfig"; path = "Target Support Files/Pods-KNU_CSE/Pods-KNU_CSE.debug.xcconfig"; sourceTree = "<group>"; };
949F8006B59C6CB5B5F67EA7 /* Pods-KNU_CSETests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-KNU_CSETests.debug.xcconfig"; path = "Target Support Files/Pods-KNU_CSETests/Pods-KNU_CSETests.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -176,7 +178,7 @@
68F1A5E726A008FF007B4B86 /* Web Service */ = {
isa = PBXGroup;
children = (
68F1A5E826A008FF007B4B86 /* SingUpRequest.swift */,
68F1A5E826A008FF007B4B86 /* Request.swift */,
68F1A5E926A008FF007B4B86 /* GetEventListApiRequest.swift */,
68F1A5EA26A008FF007B4B86 /* BaseObject.swift */,
68F1A5EB26A008FF007B4B86 /* BaseApiRequest.swift */,
Expand All @@ -198,7 +200,7 @@
isa = PBXGroup;
children = (
68F1A5F526A0090B007B4B86 /* BindingTextField.swift */,
68F1A5FD26A07147007B4B86 /* SignUpUiLabel.swift */,
68F1A5FD26A07147007B4B86 /* SignUpUILabel.swift */,
68F1A5FF26A07FE7007B4B86 /* CheckBox.swift */,
);
path = Custom;
Expand All @@ -207,6 +209,7 @@
68F1A5FA26A01028007B4B86 /* SignIn */ = {
isa = PBXGroup;
children = (
68F1A60426A1598A007B4B86 /* SignInModel.swift */,
68F1A5BB26A0088B007B4B86 /* SignInView.swift */,
68F1A5FB26A01080007B4B86 /* SignInViewModel.swift */,
);
Expand Down Expand Up @@ -487,16 +490,17 @@
68F1A5B826A0088B007B4B86 /* AppDelegate.swift in Sources */,
68F1A5ED26A008FF007B4B86 /* GetEventListApiRequest.swift in Sources */,
68F1A5F826A0090B007B4B86 /* SignUpViewModel.swift in Sources */,
68F1A60526A1598A007B4B86 /* SignInModel.swift in Sources */,
68F1A5EF26A008FF007B4B86 /* BaseApiRequest.swift in Sources */,
68F1A5BA26A0088B007B4B86 /* SceneDelegate.swift in Sources */,
68F1A5F626A0090B007B4B86 /* SignUpModel.swift in Sources */,
68F1A60326A0A73B007B4B86 /* Color.swift in Sources */,
68F1A5FC26A01080007B4B86 /* SignInViewModel.swift in Sources */,
68F1A5F926A0090B007B4B86 /* BindingTextField.swift in Sources */,
68F1A60026A07FE7007B4B86 /* CheckBox.swift in Sources */,
68F1A5EC26A008FF007B4B86 /* SingUpRequest.swift in Sources */,
68F1A5EC26A008FF007B4B86 /* Request.swift in Sources */,
68F1A5EE26A008FF007B4B86 /* BaseObject.swift in Sources */,
68F1A5FE26A07147007B4B86 /* SignUpUiLabel.swift in Sources */,
68F1A5FE26A07147007B4B86 /* SignUpUILabel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
File renamed without changes.
23 changes: 23 additions & 0 deletions KNU_CSE/KNU_CSE/SignIn/SignInModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// File.swift
// KNU_CSE
//
// Created by junseok on 2021/07/16.
//

import Foundation

class SignInModel : BaseObject{
var email : String
var password : String

init(email:String, password:String) {
self.email = email
self.password = password
super.init()
}

required init(from decoder: Decoder) throws {
fatalError("init(from:) has not been implemented")
}
}
4 changes: 1 addition & 3 deletions KNU_CSE/KNU_CSE/SignIn/SignInView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import M13Checkbox

class ViewController: UIViewController {

var signInViewModel : SignUpViewModel = SignUpViewModel(listener: nil)
var signInViewModel : SignInViewModel = SignInViewModel(listener: nil)

var accountUI : UIView! {
didSet{
Expand Down Expand Up @@ -54,7 +54,6 @@ class ViewController: UIViewController {
if response.result == 1 {
let alert = UIAlertController(title: "회원가입성공", message: "확인 버튼을 누르면 로그인 페이지로 이동합니다.", preferredStyle: .alert)
let actionDefault = UIAlertAction(title: "확인", style: .default){ (action) in

}
alert.addAction(actionDefault)
self.present(alert, animated: true, completion: nil)
Expand Down Expand Up @@ -149,7 +148,6 @@ class ViewController: UIViewController {
let title_height = 200
let height = 40
let top_padding = 20
let title_To_textField_margin = 3
let left_margin = 30
let right_margin = -30

Expand Down
8 changes: 6 additions & 2 deletions KNU_CSE/KNU_CSE/SignIn/SignInViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import UIKit
class SignInViewModel {
typealias Listener = (Account) -> Void
var listener: Listener?
var account: Account = Account(email: "", password: "", password2: "", username: "", nickname: "", student_id: "", gender: "", major: "")

var account: SignInModel = SignInModel(email: "", password: "")

init(listener : Listener?){
self.listener = listener
Expand All @@ -22,5 +21,10 @@ class SignInViewModel {
func bind(listener: Listener?) {
self.listener = listener
}

public func getEvent(successHandler: @escaping (Response) -> (), failHandler: @escaping (Error) -> ()) {
let signUpRequest = Request(requestBodyObject: self.account, requestMethod: .Post, enviroment: .SignIn)
signUpRequest.sendRequest(request: signUpRequest, type: Response.self, successHandler: successHandler, failHandler: failHandler)
}
}

2 changes: 0 additions & 2 deletions KNU_CSE/KNU_CSE/SignUp/SignUpView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,6 @@ class SignUpView: UIViewController {
make.top.equalTo(majorCom.snp.bottom).offset(top_padding)
make.height.equalTo(height)
}


}
}

Expand Down
2 changes: 1 addition & 1 deletion KNU_CSE/KNU_CSE/SignUp/SignUpViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SignUpViewModel {
}

public func getEvent(successHandler: @escaping (Response) -> (), failHandler: @escaping (Error) -> ()) {
let signUpRequest = SignUpRequest(requestBodyObject: self.account, requestMethod: .Post, enviroment: .SignUp)
let signUpRequest = Request(requestBodyObject: self.account, requestMethod: .Post, enviroment: .SignUp)
signUpRequest.sendRequest(request: signUpRequest, type: Response.self, successHandler: successHandler, failHandler: failHandler)
}

Expand Down
14 changes: 1 addition & 13 deletions KNU_CSE/KNU_CSE/Web Service/GetEventListApiRequest.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
//
// 1.swift
// MVVM_Practice
//
// Created by junseok on 2021/07/09.
//
//
//class GetEventListApiRequest: BaseApiRequest {
// var enviroment: Environment
//
// var requestBodyObject: BaseObject?
// var requestMethod: RequestHttpMethod?
//}

Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
//
import Alamofire

struct SignUpRequest: BaseApiRequest {
struct Request: BaseApiRequest {
var requestBodyObject: BaseObject?
var requestMethod: RequestHttpMethod? = RequestHttpMethod.Post
var enviroment: Environment?

mutating func setBodyObject(bodyObject: Account) {
mutating func setBodyObject(bodyObject: BaseObject?) {
self.requestBodyObject = bodyObject
}

Expand Down

0 comments on commit 3057389

Please sign in to comment.