Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
self.window = UIWindow(windowScene: windowScene)
let navigationController = UINavigationController(rootViewController: ViewController())
let navigationController = UINavigationController(rootViewController: LoginViewController())
self.window?.rootViewController = navigationController
self.window?.makeKeyAndVisible()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "x-circle@3x 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "x-circle@3x [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "x-circle@3x [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "eye@3x 1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "eye@3x [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "eye@3x [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "eye-slash@3x 2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "eye-slash@3x [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "eye-slash@3x [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "image 3.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "image [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "image [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions Combine_Study/Combine_Study/Extensions/Combine+/CancelBag+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// CancelBag+.swift
// Combine_Study
//
// Created by Gahyun Kim on 2024/05/09.
//

import Foundation
import Combine

class CancelBag {
var subscriptions = Set<AnyCancellable>() // 구독된 AnyCancellable 객체들을 저장하는 Set

// 모든 구독을 취소하고 subscriptions를 비운다. 이 메서드는 CancelBag 인스턴스가 더 이상 필요하지 않을 때 호출하여 메모리 누수를 방지
func cancel() {
subscriptions.forEach { $0.cancel() }
subscriptions.removeAll()
}

init() { }
}

extension AnyCancellable {
// AnyCancellable 객체를 CancelBag의 subscriptions 집합에 추가
func store(in cancelBag: CancelBag) {
cancelBag.subscriptions.insert(self)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// UITextField+.swift
// Combine_Study
//
// Created by Gahyun Kim on 2024/05/09.
//

import UIKit
import Combine

// 텍스트 필드의 변화를 감지하고 observer에게 값을 전달하기 위해 UITextField extension으로 publisher를 생성
extension UITextField {
var publisher: AnyPublisher<String, Never> { // 클로저로써 Publisher를 가져옴
NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification, object: self)
// compactMap으로 UITextField 가져왔어
.compactMap{ $0.object as? UITextField}
// map을 통해서 Textfield의 text를 가져왕
.map{ $0.text ?? "" } //값이 없는 경우 빈 문자열 반환
.print()
.eraseToAnyPublisher() //래핑이 많이 되었기 때문에 eraseToAnuPublisher
//eraseToAnuPublisher : 타입을 지운 상태의 AnyPublisher 인스턴스를 방출할 때 사용한다네!
}
}
24 changes: 24 additions & 0 deletions Combine_Study/Combine_Study/Extensions/String+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// String+.swift
// Combine_Study
//
// Created by Gahyun Kim on 2024/05/09.
//

import UIKit

extension String {
func hasCharacters() -> Bool {
do {
let regex = try NSRegularExpression(pattern: "^[가-힣ㄱ-ㅎㅏ-ㅣ]$", options: .caseInsensitive)
if let _ = regex.firstMatch(in: self, options: NSRegularExpression.MatchingOptions.reportCompletion, range: NSMakeRange(0, self.count)) {
return true
}
} catch {
print(error.localizedDescription)
return false
}

return false
}
}
30 changes: 30 additions & 0 deletions Combine_Study/Combine_Study/Extensions/UITextField+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// UITextField+.swift
// Combine_Study
//
// Created by Gahyun Kim on 2024/05/09.
//

import UIKit

extension UITextField {

/// 텍스트필드 안쪽에 패딩 추가
/// - Parameter left: 왼쪽에 추가할 패딩 너비
/// - Parameter right: 오른쪽에 추가할 패딩 너비
func addPadding(left: CGFloat? = nil, right: CGFloat? = nil) {
if let left {
leftView = UIView(frame: CGRect(x: 0, y: 0, width: left, height: 0))
leftViewMode = .always
}
if let right {
rightView = UIView(frame: CGRect(x: 0, y: 0, width: right, height: 0))
rightViewMode = .always
}
}

/// Placeholder의 색상을 바꿔주는 메서드
func changePlaceholderColor(forPlaceHolder: String, forColor: UIColor) {
self.attributedPlaceholder = NSAttributedString(string: forPlaceHolder, attributes: [NSAttributedString.Key.foregroundColor: forColor])
}
}
16 changes: 16 additions & 0 deletions Combine_Study/Combine_Study/Extensions/UIView+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// UIView+.swift
// Combine_Study
//
// Created by Gahyun Kim on 2024/05/09.
//

import UIKit

extension UIView {

/// 한 번에 여러 개의 UIView 또는 UIView의 하위 클래스 객체들을 상위 UIView에 추가
func addSubviews(_ views: UIView...) {
views.forEach { self.addSubview($0) }
}
}
Loading