[Swift] Swift 5.8 CHANGELOG
SE-0365
μ΄μ ν΄λ‘μ λ΄λΆμμ [weak self] λ‘ μΊ‘μ²ν self λ₯Ό μΈλνν μ΄νμλ self λ₯Ό μλ΅ν΄λ λ©λλ€.
class ViewController {
let button: Button
func setup() {
button.tapHandler = { [weak self] in
guard let self else { return }
dismiss() // refers to `self.dismiss()`
}
}
func dismiss() { ... }
}
Swift 5 μμλ non-escaping ν΄λ‘μ μμ [weak self] μ΄ν self λ₯Ό λͺ μμ μΌλ‘ μΈκΈνμ§ μμλ λμμ§λ§,
Swift 6 λ²μ λΆν°λ λ μ΄μ νμ©λμ§ μμ΅λλ€.
self λ₯Ό μΈλννκ±°λ, [unowned self] λ₯Ό μ¬μ©ν΄μΌλ§ μλ΅κ°λ₯ν©λλ€.
SE-0362
μ»΄νμΌλ¬ νλκ·Έ -enable-upcoming-feature X λ₯Ό ν΅ν΄
evolution process μμλ μΉμΈ λμ΄ λ€μ λ©μ΄μ λ²μ (eg. Swift 6 )μ λμ λ μμ μΈ κΈ°λ₯μ μ¬μ©ν μ μμ΅λλ€.
νμ¬ μ¬μ© κ°λ₯ν κΈ°λ₯μ μλμ κ°μ΅λλ€:
- ConciseMagicFile enables the new #file semantics in SE-0274.
- ForwardTrailingClosures disables the "backward" scanning behavior of SE-0286.
- BareSlashRegexLiterals enables the regex literal syntax of SE-0354.
μλ μ½λλ₯Ό μ¬μ©νμ¬ μ¬μ©κ°λ₯ν κΈ°λ₯μ νμ§ν μ μμ΅λλ€.
#if hasFeature(X)
μ€λλ λλ μ±μ₯νλ€!!π₯
π€ [Back to the Basics] π»
μ£Όλμ΄ iOS κ°λ°μ μ°μ§±μ κΈ°μ λΈλ‘κ·Έμ λλ€.
[μ°Έκ³ μλ£ ππ»βοΈ]
https://github.com/apple/swift-evolution/blob/main/proposals/0365-implicit-self-weak-capture.md
https://github.com/apple/swift-evolution/blob/main/proposals/0362-piecemeal-future-features.md