Skip to content

Commit d1a3a69

Browse files
committed
swift 지원 버전 5.9로 변경
1 parent 1823284 commit d1a3a69

File tree

3 files changed

+69
-19
lines changed

3 files changed

+69
-19
lines changed

Package.resolved

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.2
1+
// swift-tools-version: 5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -19,7 +19,7 @@ let package = Package(
1919
),
2020
],
2121
dependencies: [
22-
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "602.0.0-latest"),
22+
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "509.0.0"),
2323
],
2424
targets: [
2525
// Targets are the basic building blocks of a package, defining a module or a test suite.

README.md

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
11
# Delegation
22

3-
한국어 | English
3+
[![Swift Version](https://img.shields.io/endpoint?url=https://swiftpackageindex.com/api/packages/ShapeKim98/Delegation/badge?type=swift-versions)](https://swiftpackageindex.com/ShapeKim98/Delegation)
4+
[![Platform Support](https://img.shields.io/endpoint?url=https://swiftpackageindex.com/api/packages/ShapeKim98/Delegation/badge?type=platforms)](https://swiftpackageindex.com/ShapeKim98/Delegation)
45

5-
`@Delegatable` 매크로는 델리게이트 클로저를 저장하는 프로퍼티에 빌더 스타일의 체이닝 메서드를 추가해 SwiftUI 및 UIKit 구성 요소에서 호출 클로저를 간단히 주입할 수 있게 해 줍니다.
6-
`@Delegatable` generates builder-style methods for closure-backed delegate properties so SwiftUI/UIKit components can adopt chained delegate configuration with minimal boilerplate.
6+
Delegation은 델리게이트 클로저를 체이닝 방식으로 구성할 수 있게 해 주는 Swift 매크로 패키지입니다.
7+
Delegation is a Swift macro package that unlocks builder-style configuration for closure-based delegates in SwiftUI and UIKit.
8+
9+
## 주요 기능 (Features)
10+
11+
- `@Delegatable` 애트리뷰트 하나로 체이닝 가능한 빌더 메서드 자동 생성
12+
- `async`, `throws`, 다중 파라미터, `@Sendable` 등 클로저 특성 그대로 유지
13+
- 시스템 기본 언어에 맞춰 한국어/영어 진단 메시지 자동 출력
714

815
## 설치 (Installation)
916

10-
- Swift Package Manager만 지원합니다.
11-
Add only via Swift Package Manager.
17+
- Swift Package Manager만 지원하며 Swift 5.9(Xcode 15.0) 이상이 필요합니다.
18+
Swift Package Manager only, requiring Swift 5.9 (Xcode 15.0) or newer.
1219
- `Package.swift``dependencies``targets` 섹션에 아래와 같이 추가하세요.
1320
Add the package to the `dependencies` and `targets` sections as shown below.
1421

1522
```swift
16-
// swift-tools-version: 6.2
23+
// swift-tools-version: 5.9
1724
import PackageDescription
1825

1926
let package = Package(
2027
name: "YourApp",
2128
platforms: [.iOS(.v14), .macOS(.v11), .tvOS(.v14), .watchOS(.v7), .macCatalyst(.v13)],
2229
dependencies: [
23-
.package(url: "https://github.com/ShapeKim98/Delegation.git", from: "0.1.0")
30+
.package(url: "https://github.com/ShapeKim98/Delegation.git", from: "0.2.0")
2431
],
2532
targets: [
2633
.target(
@@ -33,8 +40,8 @@ let package = Package(
3340
)
3441
```
3542

36-
> 현재 최신 태그는 `0.1.0`이며 릴리스에 맞춰 갱신해 주세요.
37-
> The current release tag is `0.1.0`; bump it as you publish newer versions.
43+
> 현재 최신 태그는 `0.2.0`이며 릴리스에 맞춰 갱신해 주세요.
44+
> The current release tag is `0.2.0`; bump it as you publish newer versions.
3845
3946
## 사용 방법 (Usage)
4047

@@ -128,12 +135,56 @@ ContentView()
128135
- 패키지는 별도 실행 타깃을 포함하지 않으며, 위 코드는 문서용 예시입니다.
129136
The package ships without an executable sample target; the snippet above is for documentation only.
130137

138+
## UIKit 예제 (UIKit Example)
139+
140+
UIKit 환경에서도 동일하게 체이닝된 델리게이트 구성을 적용할 수 있습니다.
141+
The same chaining pattern works in UIKit-based view controllers.
142+
143+
```swift
144+
import UIKit
145+
import Delegation
146+
147+
final class ListViewController: UIViewController {
148+
@Delegatable var showDetail: ((String) -> Void)?
149+
@Delegatable var presentSettings: (() -> Void)?
150+
151+
override func viewDidLoad() {
152+
super.viewDidLoad()
153+
154+
view.backgroundColor = .systemBackground
155+
156+
let button = UIButton(type: .system)
157+
button.setTitle("설정 열기", for: .normal)
158+
button.addAction(UIAction { [weak self] _ in
159+
self?.presentSettings?()
160+
}, for: .touchUpInside)
161+
162+
view.addSubview(button)
163+
button.translatesAutoresizingMaskIntoConstraints = false
164+
NSLayoutConstraint.activate([
165+
button.centerXAnchor.constraint(equalTo: view.centerXAnchor),
166+
button.centerYAnchor.constraint(equalTo: view.centerYAnchor)
167+
])
168+
}
169+
170+
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
171+
let identifier = "item-\(indexPath.row)"
172+
showDetail?(identifier)
173+
}
174+
}
175+
176+
let controller = ListViewController()
177+
.showDetail { id in print("detail: \(id)") }
178+
.presentSettings { print("settings") }
179+
```
180+
181+
- 샘플 코드는 문서용 예시이며, 실제 앱 구조에 맞춰 델리게이트 채택과 레이아웃을 조정하세요.
182+
The snippet is documentation-only; adapt delegate conformance and layout to your project needs.
183+
131184
## 플랫폼 요구 사항 (Platform Requirements)
132185

133-
- `Package.swift`는 Swift 6.2 매니페스트 형식을 사용하며 최소 지원 플랫폼은 `iOS 13 / macOS 10.15 / tvOS 13 / watchOS 6 / macCatalyst 13` 이상입니다.
134-
The manifest targets Swift tools 6.2 with minimum deployment targets of iOS 13, macOS 10.15, tvOS 13, watchOS 6, and macCatalyst 13.
135-
- SwiftUI 예시는 런타임에서 `@available` 속성을 통해 iOS 14, macOS 11, tvOS 14, watchOS 7 이상에서만 활성화됩니다.
136-
The SwiftUI demo activates on iOS 14, macOS 11, tvOS 14, watchOS 7 and newer via availability annotations.
186+
- `Package.swift`는 Swift 5.9 매니페스트 형식을 사용하며 최소 지원 플랫폼은 `iOS 13 / macOS 10.15 / tvOS 13 / watchOS 6 / macCatalyst 13` 이상입니다.
187+
The manifest targets Swift tools 5.9 with minimum deployment targets of iOS 13, macOS 10.15, tvOS 13, watchOS 6, and macCatalyst 13.
137188

138189
## 라이선스 (License)
139190

0 commit comments

Comments
 (0)