Cuvva 運用 Compose 提升建構速度和品質
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Cuvva 提供真正彈性的保險管理方式,讓您透過手機就能輕鬆管理保險,大幅提升保險體驗。《Cuvva》的 Android 工程師花了一些時間重新設計應用程式架構,並決定採用單向資料流和 Jetpack Compose。這樣一來,他們就能擺脫以自訂 View 為基礎的設計系統,因為這個系統速度較慢、難以使用,而且在舊版 Android 上較難預測。
具體措施
Cuvva 團隊從頭開始建立新的設計元件,然後使用互通性 API 將可組合項放置在現有版面配置中,並隨著時間推移,逐步取代以 View 為基礎的畫面,並使用 Compose 建構新畫面。「我們發現,Compose 可讓我們更快速從頭開始建立新的設計元件,並減少嘗試解決狀態管理或片段化問題的時間。建立足夠大的元件庫後,我們就能快速推出新畫面,這確實有助於提升工作效率。」
結果
Compose 讓他們能更快建構出更高品質的應用程式:「Compose 可讓我們快速獲取新功能,因此我們能夠比以往更快疊代,為客戶提供更優質的體驗。」
使用 Compose 後,您需要編寫的程式碼行數減少,因此需要閱讀、瞭解及維護的程式碼也減少了:「只需要編寫寥寥數行程式碼,即可在應用程式中建立清單或動畫,我們對這一點感到非常滿意。Compose 確實大幅減少了建構 UI 所需的程式碼行數。」
自訂元件更容易導入:「我們建立了一個圓形撥號元件,用來向顧客顯示駕駛分數。使用 Compose 為進度和顏色設定動畫,比以往簡單許多,也更有趣。無論是建立新元件或變更現有元件的行為,在 Compose 中自訂任何內容都容易得多。」
開始使用
進一步瞭解「撰寫」。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2021-07-28 (世界標準時間)。
[null,null,["上次更新時間:2021-07-28 (世界標準時間)。"],[],[],null,["[Cuvva](https://www.cuvva.com/) is making insurance radically better\nby giving you a truly flexible way to manage your cover, all from your phone.\nThe Android engineers at Cuvva got to spend some time re-architecting their app\nand decided to adopt a unidirectional data flow and Jetpack Compose. That way\nthey could **move away from their custom View based design system**, which was\nslower and harder to work with, and less predictable on older versions of\nAndroid.\n\nWhat they did\n\nThe Cuvva team created new design components from scratch, then used the\ninteroperability APIs to place Composables inside existing layouts and, with\ntime, replace View-based screens and build new screens with Compose. *\"We found\nthat Compose lets us create new design components from scratch **much more\nrapidly** and spend less time trying to work around state management or\nfragmentation. Once we had built up a large enough library of these components,\nshipping a new screen became very fast, and it has definitely helped us to be\nmore productive.\"*\n\nResults\n\nCompose allowed them to build a higher quality app faster: *\"The speed at which\nCompose allows us to put together a new feature means **we can iterate more\nrapidly, providing a higher-quality experience** for our customers faster than\nbefore.\"*\n\nWith Compose the number of lines you need to write, and therefore read,\nunderstand, and maintain, decreases: *\"we were very pleased to see how few lines\nwere required to create lists or animations in our app. Compose has definitely\n**dramatically reduced the number of lines of code** required to build our UI.\"*\n\nCustom components are easier to implement: *\"We created a circular dial\ncomponent which is used to show customers their driving score. **Animating** its\nprogress and colours with Compose was **far easier and a lot more fun** than it\nwould have been previously. Doing anything custom, whether that's new\ncomponents or changing the behaviour of existing ones, is far easier in\nCompose.\"*\n\nGet started\n\nLearn more about [Compose](/jetpack/compose)."]]