A modular SwiftUI application demonstrating clean architecture, feature reusability, and separation of concerns.
| Login Screen | Feed Screen | Profile Screen |
|---|---|---|
![]() |
![]() |
![]() |
PostsApp is a SwiftUI-based iOS application for browsing, reading, and managing articles. The app features a secure login flow, a feed of articles, and a user profile section. Users can authenticate, view a personalized feed, read article details, and manage their profile information. The app also supports offline mode, allowing users to view the last fetched page of articles even without an internet connection. It is built with a modular architecture, separating each feature into its own module for maintainability and reusability. The Core module provides shared state, error handling, and utilities, while the main app composes these modules and manages navigation and dependencies.
PostsApp/
β
βββ Core/ # Shared models, state, error handling, utilities
βββ FeedFeature/ # Feed listing and details
βββ LoginFeature/ # Login flow
βββ ProfileFeature/ # User profile
βββ PostsApp/ # App composition, DI, navigation, assets
βββ Pods/ # External dependencies (Alamofire, SDWebImage, etc.)
βββ build/ # Build artifacts
βββ fastlane/ # CI/CD scripts
βββ vendor/ # Third-party code
βββ PostsApp.xcodeproj/ # Xcode project
βββ PostsApp.xcworkspace # Xcode workspace
βββ README.md # Project documentation
PostsApp
βββ Core
β βββ AppState.swift
β βββ ContentState.swift
β βββ NetworkError.swift
β βββ Utilities
β βββ Core.docc
βββ FeedFeature
β βββ Sources
β βββ FeedFeature.docc
βββ LoginFeature
β βββ LoginModel.swift
β βββ LoginProvider.swift
β βββ LoginService.swift
β βββ LoginView.swift
β βββ LoginViewModel.swift
β βββ LoginFeature.docc
βββ ProfileFeature
β βββ ProfileUser.swift
β βββ ProfileView.swift
β βββ ProfileFeature.docc
βββ PostsApp
β βββ AppDI.swift
β βββ KeyChainHelper.swift
β βββ PostsAppApp.swift
β βββ RootView.swift
β βββ Assets.xcassets
β βββ Feed
β βββ Feed.xcdatamodeld
β βββ Preview Content
β βββ Info.plist
βββ Pods
β βββ Alamofire
β βββ SDWebImage
β βββ SDWebImageSwiftUI
β βββ ...
βββ build
βββ fastlane
βββ vendor
βββ PostsApp.xcodeproj
βββ PostsApp.xcworkspace
βββ README.md
- Core: Import in any feature for shared state, error handling, and utilities.
- FeedFeature: Use
FeedViewandFeedViewModelfor feed UI and logic. - LoginFeature: Use
LoginViewwith aLoginProviderfor login UI. - ProfileFeature: Use
ProfileViewwith aProfileUsermodel. - PostsApp: Composes features, manages navigation, and dependency injection.
import LoginFeature
let provider = LoginProvider(
viewModel: LoginViewModel(LoginService(), onLoginSuccess: { user in
// Handle login success
}),
loginViewImage: Image("login_bg", bundle: .main)
)
LoginView(provider: provider)
.environmentObject(appState)- Each module contains a
.doccfolder with markdown documentation. - See
Core/Core.docc/Core.md,FeedFeature/FeedFeature.docc/FeedFeature.md, etc.
This structure enables easy feature reuse, testability, and clean separation of concerns.
For more details, see the documentation in each module.


