Skip to content

Commit

Permalink
✨ UITextField의 CombineCocoa 추가
Browse files Browse the repository at this point in the history
# Conflicts:
#	iOS/Features/SelectSong/Package.swift
  • Loading branch information
SwiftyJunnos committed Dec 4, 2023
1 parent ca83a52 commit 2764b62
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 15 deletions.
13 changes: 10 additions & 3 deletions iOS/Features/SelectSong/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ private enum Target {

private enum Dependency {

static let msUIKit = "MSUIKit"
static let msFoundation = "MSFoundation"
static let msDesignsystem = "MSDesignSystem"
static let msUIKit = "MSUIKit"
static let combineCocoa = "CombineCocoa"
static let msLogger = "MSLogger"
static let msFoundation = "MSFoundation"

}

Expand All @@ -46,6 +47,12 @@ let package = Package(
targets: [Target.selectSong])
],
targets: [
.target(name:Target.selectSong)
.target(name:Target.selectSong,
dependencies: [
.product(name: Dependency.msUIKit,
package: Dependency.msUIKit),
.product(name: Dependency.combineCocoa,
package: Dependency.msUIKit)
])
]
)
33 changes: 21 additions & 12 deletions iOS/MSUIKit/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ import PackageDescription
extension String {

static let package = "MSUIKit"
static let designSystem = "MSDesignSystem"
static let uiKit = "MSUIKit"

}

private enum Target {

static let msDesignSystem = "MSDesignSystem"
static let msUIKit = "MSUIKit"
static let combineCocoa = "CombineCocoa"

}

Expand All @@ -21,20 +27,23 @@ let package = Package(
.iOS(.v15)
],
products: [
.library(name: .designSystem,
type: .static,
targets: [.designSystem]),
.library(name: .uiKit,
targets: [.uiKit])
.library(name: Target.msDesignSystem,
targets: [Target.msDesignSystem]),
.library(name: Target.msUIKit,
targets: [Target.msUIKit]),
.library(name: Target.combineCocoa,
targets: [Target.combineCocoa])
],
targets: [
// Codes
.target(name: .designSystem,
.target(name: Target.msDesignSystem,
resources: [
.process("../\(String.designSystem)/Resources")
.process("../\(Target.msDesignSystem)/Resources")
]),
.target(name: Target.msUIKit,
dependencies: [
.target(name: Target.msDesignSystem)
]),
.target(name: .uiKit,
dependencies: ["MSDesignSystem"])
.target(name: Target.combineCocoa)
],
swiftLanguageVersions: [.v5]
)
23 changes: 23 additions & 0 deletions iOS/MSUIKit/Sources/CombineCocoa/UITextField+Combine.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// UITextField+Combine.swift
// MSUIKit
//
// Created by 이창준 on 2023.12.03.
//

import Combine
import UIKit

public extension UITextField {

var textPublisher: AnyPublisher<String, Never> {
let publisher = NotificationCenter.default.publisher(for: UITextField.textDidChangeNotification,
object: self)

return publisher
.compactMap { $0.object as? UITextField }
.map { $0.text ?? "" }
.eraseToAnyPublisher()
}

}

0 comments on commit 2764b62

Please sign in to comment.