Atomic Design Hierarchy
1. Atoms
The basic building blocks of UI — buttons, labels, text fields, icons, colors, spacing units.
Example: PrimaryButton, AppText, Icon
2. Molecules
Groupings of atoms that form simple components.
Example: SearchBar = TextField + Icon, LabeledSwitch
3. Organisms
Relatively complex, standalone components made of atoms and molecules.
Example: LoginForm, UserCard, HeaderView
4. Templates
Layouts or skeletons that define the structure of pages using organisms.
Example: AuthScreenTemplate, DashboardTemplate
5. Pages
Final screens with real data/content, composed of templates.
Example: LoginScreen, SettingsScreen.
Here is how an example folders structure looks like in iOS app powered by SwiftUI.
MySwiftUIApp/
│
├── Resources/ // Assets, Localization, etc.
│ ├── Assets.xcassets
│ ├── Localizable.strings
│ └── Colors.swift
│
├── App/ // Entry point and configuration
│ ├── MySwiftUIAppApp.swift
│ └── AppRouter.swift
│
├── Core/ // Shared reusable logic
│ ├── Network/
│ ├── Extensions/
│ ├── Utils/
│ └── Models/
│
├── DesignSystem/ // Atomic Design Pattern folder
│ ├── Atoms/ // Basic UI elements
│ │ ├── PrimaryButton.swift
│ │ ├── AppText.swift
│ │ ├── Icon.swift
│ │ └── Spacing.swift
│ │
│ ├── Molecules/ // Small component combinations
│ │ ├── TextFieldWithIcon.swift
│ │ ├── LabeledSwitch.swift
│ │ └── ProfileImageWithName.swift
│ │
│ ├── Organisms/ // Large UI blocks
│ │ ├── LoginForm.swift
│ │ ├── UserProfileSection.swift
│ │ └── ProductCard.swift
│ │
│ ├── Templates/ // Layout structures with placeholder content
│ │ ├── AuthScreenTemplate.swift
│ │ ├── FeedPageTemplate.swift
│ │ └── SettingsPageTemplate.swift
│ │
│ └── Pages/ // Final UI Screens
│ ├── LoginScreen.swift
│ ├── HomeScreen.swift
│ └── SettingsScreen.swift
│
├── ViewModels/ // All SwiftUI ViewModels (MVVM)
│ ├── LoginViewModel.swift
│ ├── HomeViewModel.swift
│ └── SettingsViewModel.swift
│
└── Tests/ // Unit and UI Tests
├── MySwiftUIAppTests/
└── MySwiftUIAppUITests/
Advantages:
- Reusability: Components are small and self-contained, encouraging reuse.
- Consistency: Promotes a unified design language across your app.
- Scalability: Easily scale design systems by combining existing components.
- Testability: Smaller atomic components are easier to unit test.
- Clear Structure: Developers and designers have a shared, understandable component hierarchy.
- Collaboration Friendly: Makes handoff between design and development smoother.
Limitations:
- Overhead for Small Projects: May feel too heavy for very simple apps or MVPs.
- Naming Complexity: Distinguishing between molecules, organisms, templates can become ambiguous.
- Learning Curve: Developers unfamiliar with the pattern might find the structure over-engineered.
- Increased Boilerplate: Can lead to many files and folders, even for small features.
- Not Always a Natural Fit: Sometimes, trying to "force" components into the hierarchy doesn't make sense.