How leboncoin/spark-ios-component-text-input works
Project Overview
• Project type: A design system component library for iOS, specifically offering customizable TextField (including variants with addons) and TextEditor components.
Main Architectural Components
• SparkTextInput Package – Central Swift package managed using Swift Package Manager.
• Core Modules:
a. Common Module:
• Contains shared constants, enumerations, models, use cases, and a view model for text input elements.
b. TextField Module:
• Split into subcomponents: the base TextField component and its Addons.
• Separate implementation folders for UIKit and SwiftUI views.
• Contains dedicated ViewModels and additional use cases.
c. TextEditor Module:
• Provides the TextEditor component’s implementations in both SwiftUI and UIKit.
• Contains its own use case (e.g., for vertical spacing) and ViewModel.
Relationships and Data Flow
• Each UI component (TextField and TextEditor) is implemented separately for UIKit and SwiftUI – this separation should be reflected by splitting the views into distinct branches.
• The Addons for TextField extend the base component functionality with additional supporting views, view models, and accessibility identifiers.
• Testing components are logically separate – unit tests verify use cases and view models, while snapshot tests validate UI rendering for both UIKit and SwiftUI implementations.
Important Architectural Patterns
• MVVM (Model-View-ViewModel): Both TextField and TextEditor use this pattern with clear separation between the view (SwiftUI or UIKit), the view model (which encapsulates the UI logic), and the model (provided by common configurations).
• Modularization: Projects are split into “Common”, “TextField” (and its addons), and “TextEditor” folders, clearly indicating separation of concerns.
Elements
• From that, create branches for:
• Common Module: inside it, list “Constants”, “Enums”, “Models”, “Use Cases”, and “ViewModel”.
• TextField Module: further branch into two:
• Base TextField
• TextField with Addons (include sub-branches for SwiftUI and UIKit implementations, along with their ViewModels).
• TextEditor Module: branch into SwiftUI and UIKit implementations, plus its own Use Case and ViewModel.
• A separate branch for CI/CD workflows (GitHub Actions defined in the .github directory) indicating tasks like building demo apps and deploying documentation.