# Organize your Views: SwiftUI edition

DevFeed: [Organize your Views: SwiftUI edition](<https://devfeed.tech/articles/organize-your-views-swiftui-edition-25574.md>)

Original publisher: [Read original article](<https://www.marcogomiero.com/posts/2023/organize-view-swiftui-edition/>)

Author: Marco Gomiero

Published: 2023-03-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Posts on Marco Gomiero](<https://devfeed.tech/sources/posts-on-marco-gomiero.md>)

Topics: [SwiftUI](<https://devfeed.tech/topics/swiftui.md>), [ui](<https://devfeed.tech/topics/ui.md>), [Code](<https://devfeed.tech/topics/code.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [components](<https://devfeed.tech/tags/components.md>), [declarative](<https://devfeed.tech/tags/declarative.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [maintainability](<https://devfeed.tech/tags/maintainability.md>), [readability](<https://devfeed.tech/tags/readability.md>), [state](<https://devfeed.tech/tags/state.md>), [stateless](<https://devfeed.tech/tags/stateless.md>), [swift](<https://devfeed.tech/tags/swift.md>), [swiftui](<https://devfeed.tech/tags/swiftui.md>), [ui](<https://devfeed.tech/tags/ui.md>), [ui-components](<https://devfeed.tech/tags/ui-components.md>)

## AI overview

This tutorial explains how to organize SwiftUI views in a Kotlin Multiplatform money-management app. It recommends keeping each screen's entry-point view small, splitting UI into reusable components, hoisting state so views remain stateless, and isolating ViewModel and external-dependency connections. The author reports improved readability and maintainability.

## Source excerpt

One of the pros of SwiftUI, and generally of declarative UI frameworks, is the capability of defining the UI with the same programming language the application uses. With SwiftUI, it is not necessary anymore to bridge the UI definitions from somewhere else, resulting in a decrease of context switching between two different environments (Storyboards and Swift code, for example) But "with great power comes great responsibility", and a codebase can quickly become a nightmare without some structure and organization. Long files, large structs, and stateful UI components that hinder reusability are examples that can lead to a messed codebase.