13的話
最近軟體界在吵 AI,Apple 靜悄悄。
我最在意的卻是 WWDC23 的消息怎麼還沒公告?(還記得某一年公告抽到票的結果選在 4/1 發布,幽默。)
如果還沒有 WWDC 消息的話,下週連假我預計會停刊一次。
上一期提到 iPlayground 2023 已經啟動籌備計畫,感謝不少朋友來信詢問加入工作人員。我都有一一回覆了。如果沒收到信的話可以檢查一下,或是再聯絡我一次。
請訂閱 Patreon 來支持我的電子報🙏
🧪Apple Releases
RC 囉。
📦Swift Package Index gains Apple sponsorship
Swift Package Index 是第三方開發者建立的 SPM 查詢網站,是 Swift 社群的重要資產。為了建立索引,它們必須 build 每個 library 的每個版本,這個開銷不小。
現在 Apple 出錢支援該網站了,好事一件。
🌀SE-0393: Value and Type Parameter Packs
Swift 的一直有 generics,不過綁定的 type 數量是固定的。這有什麼問題呢?你可以看一下這幾個東西:
Combine Publishers 的 Merge8:
struct Merge8<A, B, C, D, E, F, G, H> where A : Publisher, B : Publisher, C : Publisher, D : Publisher, E : Publisher, F : Publisher, G : Publisher, H : Publisher, A.Failure == B.Failure, A.Output == B.Output, B.Failure == C.Failure, B.Output == C.Output, C.Failure == D.Failure, C.Output == D.Output, D.Failure == E.Failure, D.Output == E.Output, E.Failure == F.Failure, E.Output == F.Output, F.Failure == G.Failure, F.Output == G.Output, G.Failure == H.Failure, G.Output == H.OutputSwiftUI ViewBuilder 的 buildBlock()。從 1 個到 10 個 View 要寫 10 個版本。Apple 沒有再寫下去,所以超過 10 個你就得自己包一層 Group。
static func buildBlock<C0, C1, C2, C3, C4, C5, C6, C7, C8, C9>(
_ c0: C0,
_ c1: C1,
_ c2: C2,
_ c3: C3,
_ c4: C4,
_ c5: C5,
_ c6: C6,
_ c7: C7,
_ c8: C8,
_ c9: C9
) -> TupleView<(C0, C1, C2, C3, C4, C5, C6, C7, C8, C9)> where C0 : View, C1 : View, C2 : View, C3 : View, C4 : View, C5 : View, C6 : View, C7 : View, C8 : View, C9 : View如果 Swift 支援 Variadic Generics,就能省下一大堆程式碼,在一個 function 就可以支援任意數量的 generics。
這個 Evolution 可以說是 Variadic Generics 的前置作業,已經實作且在 review 階段了。
新的功能叫做 value parameter pack 以及 type parameter pack (each T)。
不過我得警告你,讀起來會很辛苦。可以跳著讀。
✨What Star Wars Can Teach Us About Swift──Paul Hudson
Paul 這週遇到一件事情:他這部 2018 的影片,有人看了幾十萬次,導致吃掉太多頻寬,帳號差點被關閉。

後來他把這部影片改放在 YouTube。因為太幽默了,所以推薦給大家。
🔑We updated our RSA SSH host key──GitHub
這週在用 GitHub 時,有遇到這段錯誤訊息嗎?
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in ~/.ssh/known_hosts to get rid of this message.
Host key for github.com has changed and you have requested strict checking.
Host key verification failed.別擔心,問題不在你,而是 GitHub。
因為他們不小心把 RSA SSH private key 開源了😅
正確更新 known_hosts 的方式在文章裡有。
🤝社群活動
2022 Swift Community Awards:上週已報導,提名階段至 3/31。
🤪Random Tweets
不實用的 fancy 介面又來了。

痛 code!
有遇過的舉手~


公開上架前的測試技巧。


個人最近的體會:
🙏支持 13 寫作,請訂閱我的 Patreon。也歡迎按喜歡❤️、留言💬、回信✉️與我交流。



