Skip to content

Conversation

@gasparnd
Copy link

image

📦 What was done

  • Refactored the entire project to follow MVVM architecture.

  • Extracted all business logic from ContentView into:

    • FreewriteViewModel (manages app state and main logic)

    • FreewriterFileManager (handles file persistence: .md management and PDF exports)

    • AppSettings (handles color scheme settings reactively).

  • Split ContentView into composable Components:

    • SidebarView

    • BottomNavBar

    • EntryCard

    • OptionButton

    • ChatPopOverView

  • Introduced Helpers folder for reusable utilities.

  • Improved code readability and maintainability across the project.

  • No new features were added — this is purely a code structure and organization improvement.

🔥 Motivation

  • Make the project easier to maintain, scale, and contribute to.

  • Improve separation of concerns, following best practices.

  • Enable future features to be added cleanly without bloating ContentView.

  • Ensure all file operations (read, write, update, export) are managed independently from UI.

🧹 Other Notes

  • The existing app functionality remains unchanged.

  • No behavior regression has been introduced.

  • Only structural improvements were made.

✅ Checklist for reviewers

  • Project structure migrated to MVVM cleanly.

  • No breaking changes to app functionality.

  • ContentView no longer contains business logic.

  • New FreewriteViewModel introduced and correctly handles app state.

  • File operations (create, read, update, export) are managed via FreewriterFileManager.

  • Color scheme settings are managed through AppSettings via EnvironmentObject.

  • UI components (SidebarView, BottomNavBar, EntryCard, OptionButton, ChatPopOverView) are properly separated and reusable.

  • Code readability and maintainability significantly improved.

  • No new features were added (pure refactor).

📝 Notes for reviewers

  • If needed, you can check the diff of ContentView.swift to easily confirm the extraction of UI-only code.

  • No regressions were detected in manual testing.

 . Create ViewModel with app logic
 . Create FreeWriteFileManager to manage all the file system logic
 . AIChatManager to manage ai redirection
 . New Models to clean logic
 . Extract UI to certain componentes and view to desacoplate the logic and have clean ContentView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant