Skip to content

Move TextureLayerState to HandDrawingSwiftMetal - #250

Merged
eisukekusachi merged 24 commits into
mainfrom
feature/texture-layers-state
Oct 4, 2026
Merged

eisukekusachi merged 24 commits into
mainfrom
feature/texture-layers-state

Conversation

@eisukekusachi

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new state orchestration introduces a retain cycle, an insertion race, and a texture-deletion consistency failure.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)
What changed in this PR

Moves texture-layer state ownership into the main application, leaving the view and canvas packages connected through protocols.

Changes:

  • Adds app-owned layer state, snapshots, persistence, and undo coordination.
  • Decouples texture-layer UI and canvas packages through protocol-based interfaces.
  • Moves generic texture repository utilities into Core and relocates tests.
File Description
TextureLayerView/​Tests/​TextureLayerViewTests/​TextureLayerViewModelTests.swift Adapts view-model tests to protocol-backed layers.
TextureLayerView/​Tests/​TextureLayerViewTests/​Models/​Layers/​TextureLayersModelTests.swift Removes relocated model tests.
TextureLayerView/​Tests/​TextureLayerViewTests/​Extensions/​FileManagerExtensionsTests.swift Removes relocated utility tests.
TextureLayerView/​Sources/​TextureLayerView/​Views/​Components/​TextureLayerToolbar.swift Uses protocol operations and view-model closure.
TextureLayerView/​Sources/​TextureLayerView/​Views/​Components/​TextureLayerItemView.swift Updates file header.
TextureLayerView/​Sources/​TextureLayerView/​Views/​Components/​SliderWithStepper.swift Updates file header.
TextureLayerView/​Sources/​TextureLayerView/​Views/​Components/​ReversedTextureLayerListView.swift Reads protocol-backed layers.
TextureLayerView/​Sources/​TextureLayerView/​Utils/​MTLTextureCreator.swift Removes migrated texture utility.
TextureLayerView/​Sources/​TextureLayerView/​Utils/​LocalFileConvertible.swift Removes migrated persistence utility.
TextureLayerView/​Sources/​TextureLayerView/​Utils/​ButtonThrottle.swift Updates file header.
TextureLayerView/​Sources/​TextureLayerView/​TextureMinimumLength.swift Removes migrated texture constant.
TextureLayerView/​Sources/​TextureLayerView/​TextureLayerViewModel.swift Delegates layer operations through the new protocol.
TextureLayerView/​Sources/​TextureLayerView/​TextureLayerViewDependencies.swift Removes repository coupling.
TextureLayerView/​Sources/​TextureLayerView/​TextureLayerView.swift Accepts protocol-backed layer state.
TextureLayerView/​Sources/​TextureLayerView/​TextureLayersProtocol.swift Defines the layer-view interface.
TextureLayerView/​Sources/​TextureLayerView/​TextureLayerEvent.swift Removes callback event API.
TextureLayerView/​Sources/​TextureLayerView/​Models/​Layers/​TextureLayersState.swift Removes state ownership from the view package.
TextureLayerView/​Sources/​TextureLayerView/​Models/​Layers/​TextureLayersArchiveModel.swift Removes app-specific archive model.
TextureLayerView/​Sources/​TextureLayerView/​Models/​Layers/​TextureLayerItem.swift Removes persistence-model conversion.
TextureLayerView/​Sources/​TextureLayerView/​Models/​Layers/​LayerId.swift Updates file header.
TextureLayerView/​Sources/​TextureLayerView/​Extensions/​URLExtensions.swift Removes migrated URL utilities.
TextureLayerView/​Sources/​TextureLayerView/​Extensions/​UIImageExtensions.swift Removes migrated image utilities.
TextureLayerView/​Sources/​TextureLayerView/​Extensions/​NSErrorExtensions.swift Removes migrated error utility.
TextureLayerView/​Sources/​TextureLayerView/​Extensions/​MTLTextureExtensions.swift Removes migrated texture extensions.
TextureLayerView/​Sources/​TextureLayerView/​Extensions/​FileManagerExtensions.swift Removes migrated file utilities.
TextureLayerCanvasView/​Tests/​TextureLayerCanvasViewTests/​TextureLayerSelectionTests.swift Tests canvas snapshots instead of view models.
TextureLayerCanvasView/​Sources/​TextureLayerCanvasView/​TextureLayerCanvasViewModel.swift Uses the canvas-layer protocol.
TextureLayerCanvasView/​Sources/​TextureLayerCanvasView/​TextureLayerCanvasViewDependencies.swift Sources repository interfaces from Core.
TextureLayerCanvasView/​Sources/​TextureLayerCanvasView/​TextureLayerCanvasView.swift Decouples the canvas from concrete state.
TextureLayerCanvasView/​Sources/​TextureLayerCanvasView/​TextureLayerCanvasRenderer.swift Renders lightweight layer snapshots.
TextureLayerCanvasView/​Sources/​TextureLayerCanvasView/​Layers/​TextureLayerSelection.swift Selects canvas snapshots.
TextureLayerCanvasView/​Sources/​TextureLayerCanvasView/​Layers/​TextureLayers.swift Builds layer collections from the protocol.
TextureLayerCanvasView/​Sources/​TextureLayerCanvasView/​Layers/​TextureLayerCanvasProtocol.swift Defines the canvas-facing layer API.
TextureLayerCanvasView/​Package.swift Replaces the view-package dependency with Core.
HandDrawingSwiftMetalTests/​Models/​Layers/​TextureLayersStateTests.swift Relocates state tests to the app target.
HandDrawingSwiftMetalTests/​Models/​Layers/​TextureLayersSnapshotTests.swift Adds snapshot normalization tests.
HandDrawingSwiftMetalTests/​Models/​Layers/​TextureLayerModelDummy.swift Relocates model test helpers.
HandDrawingSwiftMetalTests/​Models/​Layers/​RemoveLayerIndexTests.swift Relocates removal-index tests.
HandDrawingSwiftMetalTests/​Models/​Layers/​MoveLayerIndicesTests.swift Relocates movement-index tests.
HandDrawingSwiftMetalTests/​Models/​Layers/​AddLayerIndexTests.swift Relocates insertion-index tests.
HandDrawingSwiftMetal/​Utils/​TimeStampFormatter.swift Updates ownership metadata.
HandDrawingSwiftMetal/​Resources/​Localizable.xcstrings Adds migrated error strings.
HandDrawingSwiftMetal/​Models/​Undo/​UndoTextureLayerViewModel.swift Replaces subclassing with an undo registrar.
HandDrawingSwiftMetal/​Models/​Undo/​UndoDrawing.swift Uses app-owned layer models.
HandDrawingSwiftMetal/​Models/​Undo/​UndoCoordinator.swift Updates thumbnail handling.
HandDrawingSwiftMetal/​Models/​TextureLayers/​TextureLayersState.swift Adds app-owned state and operation orchestration.
HandDrawingSwiftMetal/​Models/​TextureLayers/​TextureLayersSnapshot.swift Adds persistence snapshots.
HandDrawingSwiftMetal/​Models/​TextureLayers/​TextureLayerModel.swift Relocates the persistent layer model.
HandDrawingSwiftMetal/​Models/​TextureLayers/​RemoveLayerIndex.swift Relocates removal-index logic.
HandDrawingSwiftMetal/​Models/​TextureLayers/​MoveLayerIndices.swift Relocates movement-index logic.
HandDrawingSwiftMetal/​Models/​TextureLayers/​AddLayerIndex.swift Relocates and exposes insertion logic.
HandDrawingSwiftMetal/​Models/​Project/​TextureLayersArchiveModel.swift Adds app-owned archive conversion.
HandDrawingSwiftMetal/​Models/​Project/​ProjectContent.swift Stores layer snapshots.
HandDrawingSwiftMetal/​Models/​CoreData/​CoreDataTextureLayerStorage.swift Persists app-owned state.
HandDrawingSwiftMetal/​HandDrawingViewModel+IO.swift Reads and writes layer snapshots.
HandDrawingSwiftMetal/​HandDrawingViewModel+File.swift Refreshes thumbnails after file operations.
HandDrawingSwiftMetal/​HandDrawingViewModel.swift Creates and configures the new state.
HandDrawingSwiftMetal/​HandDrawingViewController.swift Wires state, canvas, UI, and undo.
HandDrawingSwiftMetal.xcodeproj/​project.pbxproj Registers relocated sources and tests.
Core/​Sources/​Core/​Utils/​Logger.swift Removes the redundant string error overload.
Core/​Sources/​Core/​Repositories/​TextureLayersDocumentsRepository/​TextureLayersDocumentsRepositoryProtocol.swift Generalizes repository APIs around UUIDs.
Core/​Sources/​Core/​Repositories/​TextureLayersDocumentsRepository/​TextureLayersDocumentsRepository.swift Moves texture-byte storage into Core.
Core/​Sources/​Core/​Extensions/​MTLTexture.swift Adds texture data extraction in Core.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread HandDrawingSwiftMetal/Models/TextureLayers/TextureLayersState.swift Outdated
Comment thread HandDrawingSwiftMetal/Models/TextureLayers/TextureLayersState.swift Outdated
Comment thread HandDrawingSwiftMetal/Models/TextureLayers/TextureLayersState.swift Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Layer undo can target the wrong item, async canvas refreshes can display stale selections, and several new error-path tests can pass without observing an error.

Review effort: Balanced
Findings: 1 High severity · 3 Medium severity · 1 Low severity

Open (5)
Resolved since last review (3)

Comment thread HandDrawingSwiftMetal/Models/Undo/UndoTextureLayerViewModel.swift
Comment thread HandDrawingSwiftMetal/Models/Undo/UndoableTextureLayersState.swift
Comment thread TextureLayerView/Sources/TextureLayerView/TextureLayerView.swift Outdated
Comment thread HandDrawingSwiftMetalTests/Models/Undo/UndoableTextureLayersStateTests.swift Outdated
@eisukekusachi
eisukekusachi marked this pull request as ready for review October 4, 2026 05:21
@eisukekusachi
eisukekusachi merged commit ce0ee7f into main Oct 4, 2026
1 check passed
@eisukekusachi
eisukekusachi deleted the feature/texture-layers-state branch October 4, 2026 05:46
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.

2 participants