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
- APNS
- 티스토리챌린지
- 오블완
- modern concurrency
- 야곰 # 야곰아카데미커리어스타터캠프 #iOS개발자 # 부트캠프
- WWDC
- ios
- SWIFT
- modern concurrency deep dive
Archives
- Today
- Total
Geon
Write Swift macros(1) 본문
Swift Macros
Swift 매크로를 사용하면 컴파일 타임에 반복적인 코드를 생성하여 앱의 코드베이스를 더욱 표현적이고 읽기 쉽게 만들수 있다.
public struct StringifyMacro: ExpressionMacro {
public static func expansion(
of node: some FreestandingMacroExpansionSyntax,
in context: some MacroExpansionContext
) -> ExprSyntax {
guard let argument = node.argumentList.first?.expression else {
fatalError("compiler bug: the macro does not have any arguments")
}
return "(\(argument), \(literal: argument.description))"
}
}
'SwiftUI > 지식 창고' 카테고리의 다른 글
Write Swift macros(2) (0) | 2024.11.13 |
---|---|
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 |