[WWDC21] What's new in Swift
cozzin opened this issue · comments
Update on Swift packages
Swift Package Collection
- 패키지를 검색해서 찾기 쉬움
- CocoaPods Specs 같은 느낌
Data Sturcture
Swift Collections
Deque
- Array 같은건데, 양쪽 끝으로 삽입 삭제가 가능
OrderedSet
- 순서가 있는 Set
- Random Access도 가능
- Set 이랑 동일하게 Element가 하나만 있는 걸 보장해줌
OrderDictionary
- 순서대로 접근 가능
- Random Access도 가능
Algorithms
- extension으로 구현해서 쓰던게 이제 기본으로 많이 제공되는 듯
- (코테 칠때 편할듯)
https://developer.apple.com/videos/play/wwdc2021/10256/
Swift System
FilePath
- window path가 뭐지? Root도 지정할 수 있는 간편한 방법을 제공
Swift Numerics
작년에 Float16
타입 도입되었는데, 이번에 Apple Silicon에 Float16
에도 추가됨.
- Float16-based complex number 구성 가능
Complex
: 로그, 사인, 코사인 표현 가능
ArgumentParser
- Fish shell completion scripts
- Joined short options (-Ddebug)
- Improved error messages
이런거 보면 Swift로 만든 스크립트 작성이 편할 듯
Swift Server
- Static linking on Linux
- Imporved JSON performance
- Enhanced AWS Lambda runtime: 아무튼 빠름
Developer experience improvements
Swift DocC
-
문서화 제대로 지원 가능
-
interactive
-
오픈소스로 공개 예정
Type checker 퍼포먼스 개선
Build Improvements
- imported modules이 변경되었을 때 빌드 속도 빨라짐
- compile 시작전 시간 빨라짐
- extension 코드가 변경되었을때 재컴파일 적게함
Memory Management
- 더 효율적으로 관리
Ergonomic improvements
Result Builders
- 원래는 SwiftUI를 위해 디자인됨
- 복잡한 계층구조를 유연하게 표현가능
- 다양한 곳에서 사용할 수 있음
- https://developer.apple.com/videos/play/wwdc2021/10253/
Enum Codable synthesis
Flexible static member lookup
Protocol에 static var로 확장해두면 사용하는 곳에서 간편하게 사용 가능.
Property wrappers on parameters
코드 개선해보기
기존
개선
https://developer.apple.com/videos/play/wwdc2021/10018/
Asynchronous and concurrent programming
코드 살펴보기
기존
개선
Structured Concurrency
기본
병렬
Actor
멀티 스레딩 이슈
Actor 사용
actor는 클래스와 같이 reference type임
하지만 멀티 스레드에서 안전하게 사용할 수 있도록 규칙이 적용됨
Protect mutable state with Swift actors
Looking ahead to Swift6
- Safe Concurrency 동시성 이슈에 초집중할듯!
- 스위프트 포럼에 참여해달라!