52 min

70: Swift Runtime 之 Method Dispatch—Static, Table, or Message weak self

    • Technology

波肥來介紹 Swift 的 method dispatch。

{ 完整節目筆記 https://weakself.dev/episodes/70 }

👋開場

⏪上集節目回顧
聽眾 dan12411 貢獻他的 Xcode 技巧。

📰一週開發者新聞

🧪Xcode 12.5 beta 3 & iOS 14.5 beta 3
⏬XcodesApp
🥰工程師幹話—工程師應該要放心大膽的不寫文件
🧩Flutter 2 is here



⭐️Swift Runtime 1—Method Dispatch in Swift/ObjC: Static, Table, Message Dispatch

struct 的 func 一定是 static dispatch。因為 optimization 設定的不同,有可能會是 inline
class 的 func 通常是 table dispatch。如果加了 final 或是在 extension 定義新 func 就會是 static。
Swift 裡的NSObject subclass,一般 func 也是 table dispatch,即使加了 @objc 也一樣。若是 @objc dynamic就會是 message dispatch。如果加了 final 就會是 static
想要自行研究的話,可以用以下方法(程式碼請見完整節目筆記)
用 swiftc -emit-silgen Foo.swift -Onone 即可得到 SIL



💸勸敗話題

13 的開發者週報 歡迎大家來貼職缺或求職作品
小小夢魘2



👋收尾

更多 weak self

聽眾信箱 weakself.dev@gmail.com
官網 https://weakself.dev
主持人 一三、波肥、喬喬
Twitter @weak_self
提問箱
贊助 weak self

波肥來介紹 Swift 的 method dispatch。

{ 完整節目筆記 https://weakself.dev/episodes/70 }

👋開場

⏪上集節目回顧
聽眾 dan12411 貢獻他的 Xcode 技巧。

📰一週開發者新聞

🧪Xcode 12.5 beta 3 & iOS 14.5 beta 3
⏬XcodesApp
🥰工程師幹話—工程師應該要放心大膽的不寫文件
🧩Flutter 2 is here



⭐️Swift Runtime 1—Method Dispatch in Swift/ObjC: Static, Table, Message Dispatch

struct 的 func 一定是 static dispatch。因為 optimization 設定的不同,有可能會是 inline
class 的 func 通常是 table dispatch。如果加了 final 或是在 extension 定義新 func 就會是 static。
Swift 裡的NSObject subclass,一般 func 也是 table dispatch,即使加了 @objc 也一樣。若是 @objc dynamic就會是 message dispatch。如果加了 final 就會是 static
想要自行研究的話,可以用以下方法(程式碼請見完整節目筆記)
用 swiftc -emit-silgen Foo.swift -Onone 即可得到 SIL



💸勸敗話題

13 的開發者週報 歡迎大家來貼職缺或求職作品
小小夢魘2



👋收尾

更多 weak self

聽眾信箱 weakself.dev@gmail.com
官網 https://weakself.dev
主持人 一三、波肥、喬喬
Twitter @weak_self
提問箱
贊助 weak self

52 min

Top Podcasts In Technology

Lex Fridman Podcast
Lex Fridman
All-In with Chamath, Jason, Sacks & Friedberg
All-In Podcast, LLC
No Priors: Artificial Intelligence | Machine Learning | Technology | Startups
Conviction | Pod People
BG2Pod with Brad Gerstner and Bill Gurley
BG2Pod
Acquired
Ben Gilbert and David Rosenthal
Hard Fork
The New York Times