Skip to content

Bugfix/more embedded viewmodel support#95

Merged
foscomputerservices merged 7 commits intomainfrom
bugfix/more-embedded-viewmodel-support
Jan 2, 2026
Merged

Bugfix/more embedded viewmodel support#95
foscomputerservices merged 7 commits intomainfrom
bugfix/more-embedded-viewmodel-support

Conversation

@foscomputerservices
Copy link
Copy Markdown
Owner

No description provided.

foscomputerservices and others added 7 commits December 24, 2025 18:06
Implements path-based ModelRegistry to correctly distinguish between
multiple ViewModels of the same type during encoding. Previously, all
instances of the same ViewModel type would share the same substitution
values because lookup was only by type.

Key changes:
- Add ModelRegistry class for path-based model registration and lookup
- Add unwrapOptional() to handle Optional ViewModels in allPropertyNames()
- Update currentModel(for:) to use codingPath for accurate model lookup
- Update LocalizingEncoder.encode() to build registry before encoding

This enables patterns like having innerViewModel1 and innerViewModel2
of the same type, each with their own substitution values.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New test files:
- ModelRegistryTests.swift: 9 tests for path-based model lookup
- LocalizableDateTests.swift: 25 tests for date localization

Enhanced existing tests:
- EmbeddedViewModelTests: +10 tests for optionals, deep nesting, collections
- LocalizablePropertyTests: +6 tests for error paths, encoder state
- LocalizableSubstitutionsTests: +8 edge case tests

Total: 58 new tests validating ModelRegistry path resolution,
LocalizableDate formatting, optional ViewModel handling, and
substitution edge cases.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update EmbeddedViewModelTests and ModelRegistryTests to use
  expectFullViewModelTests() pattern for comprehensive multi-locale
  testing (codable, versioning, translations)
- Add Spanish translations for all test ViewModels in YAML files
- Expand FOSMVVMArchitecture.md Testing Support section with
  LocalizableTestCase documentation and testing patterns
- Create fosmvvm-viewmodel-test-generator skill with SKILL.md
  and reference.md templates for generating ViewModel tests
- Bump plugin version to 1.3.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@foscomputerservices foscomputerservices merged commit cde8cf9 into main Jan 2, 2026
5 checks passed
@foscomputerservices foscomputerservices deleted the bugfix/more-embedded-viewmodel-support branch January 2, 2026 14:23
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