Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- modern concurrency
- ios
- APNS
- 야곰 # 야곰아카데미커리어스타터캠프 #iOS개발자 # 부트캠프
- WWDC
- modern concurrency deep dive
- 티스토리챌린지
- 오블완
- SWIFT
Archives
- Today
- Total
Geon
Write Swift macros(2) 본문
Macro tests
- test를 통해 매크로의 에러 여부를 파악할수 있다.
let testMacros: [String: Macro.Type] = [
"SlopeSubset" : SlopeSubsetMacro.self,
]
final class WWDCTests: XCTestCase {
func testSlopeSubset() {
assertMacroExpansion(
"""
@SlopeSubset
enum EasySlope {
case beginnersParadise
case practiceRun
}
""",
expandedSource: """
enum EasySlope {
case beginnersParadise
case practiceRun
init?(_ slope: Slope) {
switch slope {
case .beginnersParadise:
self = .beginnersParadise
case .practiceRun:
self = .practiceRun
default:
return nil
}
}
}
""",
macros: testMacros
)
}
}
- 해당 wwdc 영상은 추후 한번더 확인해봐야겠다.
'SwiftUI > 지식 창고' 카테고리의 다른 글
Write Swift macros(1) (0) | 2024.11.12 |
---|---|
Discover Observation in SwiftUI (0) | 2024.11.11 |
Demystify SwiftUI performance (0) | 2024.11.10 |
Explore UI animation hitches and the render loop (0) | 2024.11.09 |
Image DownSampling (1) | 2024.11.08 |