跨平臺開發框架Compose Multiplatform 1.0發佈

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"JetBrains工程師Sebastian Aigner在官方博客"},{"type":"link","attrs":{"href":"https:\/\/blog.jetbrains.com\/kotlin\/2021\/12\/compose-multiplatform-1-0-is-going-live","title":"","type":null},"content":[{"type":"text","text":"宣佈"}]},{"type":"text","text":",Compose Multiplatform(Kotlin 的聲明式 UI 框架)已經發布了 1.0 版本,現在可以在生產環境中使用了。此版本主要解決質量和穩定性問題,同時修復關鍵問題和錯誤。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Compose Multiplatform 由 Compose for Desktop 和 Compose for Web 組成,通過 Kotlin Multiplatform 支持許多不同的平臺。現在,用戶可以在桌面上創建 Kotlin 應用程序,也可以使用 Compose for Web 的穩定 DOM API 構建生產質量的動態 Web 體驗,並與 Web 上的所有瀏覽器 API 完全互通。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"由於 Compose Multiplatform 是聲明式的,代碼反映了應用程序的 UI 結構,因此用戶不必擔心諸如從模型複製數據到視圖或開發 UI 刷新邏輯之類的事情。在下面這個例子中,一旦 TextField 的內容被編輯,Text label的內容將被更新,無需任何額外的代碼:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"codeblock","attrs":{"lang":"typescript"},"content":[{"type":"text","text":"var text by remember { mutableStateOf(\"Hello, World!\") }\nColumn {\n Text(text) \/\/text label\n TextField(text, {text = it}) \/\/text field\n}\n"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"“剛開始使用 Compose Multiplatform 很容易,特別是如果您之前使用過像 React 或 Google Jetpack Compose 這樣的聲明式 UI 框架。 Compose Multiplatform 使用了許多相同的概念,因此您應該有賓至如歸的感覺,”JetBrains 在博客文章中如此寫道。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Compose Desktop使用 Skia,這是一個經過良好優化的圖形庫,目前被許多對性能敏感的應用程序(包括現代瀏覽器)使用。這意味着 Compose Multiplatform 支持桌面上的所有主要的硬件加速引擎,例如 DirectX、Metal 和 OpenGL。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"它還通過預覽工具提供較短的迭代週期,允許用戶微調其 UI 的組件\/部分,並創建它們的多次迭代,而無需重新構建或重新啓動應用程序,從而縮短開發週期。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"除了桌面,Compose Multiplatform 提供了一個強大的、聲明性的 Kotlin\/JS API 來處理 DOM——它具備你在現代 Web 框架中想要和需要的所有功能,包括全面的 DOM API、內置 CSS-in-JS 支持、對 SVG 的支持等。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"“總的來說,現在在各種平臺(包括 Android,以及使用上兼容Jetpack Compose)之間共享專業知識和代碼要比之前容易得多。”Sebastian Aigner說道。其表示,在 JetBrains內部早在今年年初就開始在 "},{"type":"link","attrs":{"href":"https:\/\/www.jetbrains.com\/toolbox-app\/ ","title":"xxx","type":null},"content":[{"type":"text","text":"Jetbrains Toolbox App"}]},{"type":"text","text":" 中應用 Compose Multiplatform。這個App已經有超過100萬月活用戶,並在4個月前完全從 C++ 和 Electron 遷移到 Compose Multiplatform。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"要嘗試 Compose Multiplatform 快速開始構建面向多個平臺的應用程序,可以使用 IntelliJ IDEA 2021.1+ 中的 Kotlin 項目嚮導。附 Compose Multiplatform 官方入門教程地址:"},{"type":"link","attrs":{"href":"https:\/\/github.com\/JetBrains\/compose-jb\/tree\/master\/tutorials","title":"","type":null},"content":[{"type":"text","text":"https:\/\/github.com\/JetBrains\/compose-jb\/tree\/master\/tutorials"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"延展閱讀"},{"type":"text","text":":"},{"type":"link","attrs":{"href":"https:\/\/www.infoq.cn\/article\/qmeK2NDH8ZP2sbBGwFoE","title":"","type":null},"content":[{"type":"text","text":"《爲什麼除了 Flutter 之外,我們還需要另一個跨平臺開發框架?》"}]}]}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章