-
[Swift] Swift 5.8 CHANGELOGiOS/π Swift 2022. 11. 27. 02:28
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
'iOS > π Swift' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
COW(Copy-on-Write) λ₯Ό μμ보μ (2) 2022.12.29 [Swift] didSet μ΄ νΈμΆλλ μ°λ λλ? (2) 2022.11.06 [Swift] if case let λ₯Ό μ¬μ©νμ¬ λΆνμν μ½λ μ€μ΄κΈ° (4) 2022.01.16 [Swift] Any μ AnyObject (0) 2021.10.16 [Swift] Metatype μ΄λ? (2) 2021.10.02