Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WWDC21] What's new in Swift #38

Open
cozzin opened this issue Jul 10, 2021 · 0 comments
Open

[WWDC21] What's new in Swift #38

cozzin opened this issue Jul 10, 2021 · 0 comments

Comments

@cozzin
Copy link
Owner

cozzin commented Jul 10, 2021

Update on Swift packages

Swift Package Collection

image
image

  • 패키지를 검색해서 찾기 쉬움
  • CocoaPods Specs 같은 느낌

Data Sturcture

Swift Collections

Deque

image

  • Array 같은건데, 양쪽 끝으로 삽입 삭제가 가능

OrderedSet

image

  • 순서가 있는 Set
  • Random Access도 가능
  • Set 이랑 동일하게 Element가 하나만 있는 걸 보장해줌

OrderDictionary

image

  • 순서대로 접근 가능
  • Random Access도 가능

Algorithms

image

  • extension으로 구현해서 쓰던게 이제 기본으로 많이 제공되는 듯
  • (코테 칠때 편할듯)

https://developer.apple.com/videos/play/wwdc2021/10256/

Swift System

FilePath

image
image
image

  • window path가 뭐지? Root도 지정할 수 있는 간편한 방법을 제공

Swift Numerics

작년에 Float16 타입 도입되었는데, 이번에 Apple Silicon에 Float16에도 추가됨.

  • Float16-based complex number 구성 가능
  • Complex: 로그, 사인, 코사인 표현 가능

image

ArgumentParser

  • Fish shell completion scripts
  • Joined short options (-Ddebug)
  • Improved error messages

이런거 보면 Swift로 만든 스크립트 작성이 편할 듯

Swift Server

image

  • Static linking on Linux
  • Imporved JSON performance
  • Enhanced AWS Lambda runtime: 아무튼 빠름

image

Developer experience improvements

Swift DocC

image

Type checker 퍼포먼스 개선

image
이제는 이런 에러들 없음!

Build Improvements

  • imported modules이 변경되었을 때 빌드 속도 빨라짐
  • compile 시작전 시간 빨라짐
  • extension 코드가 변경되었을때 재컴파일 적게함

image
image

Memory Management

  • 더 효율적으로 관리

image

Ergonomic improvements

image

Result Builders

Enum Codable synthesis

image
간편하게 Codable 구현 가능

Flexible static member lookup

Protocol에 static var로 확장해두면 사용하는 곳에서 간편하게 사용 가능.
Screenshot 2021-07-10 PM 5 20 18

Property wrappers on parameters

파라미터로 사용 가능!
image

코드 개선해보기

기존

image

개선

image

https://developer.apple.com/videos/play/wwdc2021/10018/

Asynchronous and concurrent programming

image

코드 살펴보기

기존

image

개선

image
제어 흐름이 위에서 아래로 흘러서 이해하기 쉬움

Structured Concurrency

기본

image

병렬

image
async 키워드 하나면 가능

Actor

멀티 스레딩 이슈

image
여러 스레드에서 동작하면 이슈가 됨

Actor 사용

image
actor를 사용하면 스레드 이슈가 없어짐

image
await 쓸때 일반적으로 필요하다는 뜻

image
async/await 도 잘 동작함

actor는 클래스와 같이 reference type임
하지만 멀티 스레드에서 안전하게 사용할 수 있도록 규칙이 적용됨

Protect mutable state with Swift actors

Looking ahead to Swift6

  • Safe Concurrency 동시성 이슈에 초집중할듯!
  • 스위프트 포럼에 참여해달라!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant