Skip to content
CAI
Software that uses CAICheck a score

guoyingtao/Mantis

54.5

Adequate · 1 October 2026

13.6k

lines of production code

Swift

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Mantis is an iOS and macOS image-cropping library that provides both UIKit and SwiftUI interfaces for flexible image editing. It supports advanced features such as perspective skew correction, undo/redo history, and cross-session state persistence, while allowing deep UI customization through protocols and configuration structs. The system handles complex image processing tasks, including large image support and high-bit-depth formats, and is distributed via Swift Package Manager and CocoaPods.

How it got here

2018 — Mantis 3.1.0 release and infrastructure

5 changes.

This period focused on preparing and releasing Mantis version 3.1.0, which introduced cross-session crop persistence and raised the minimum deployment target to iOS 15. The work involved establishing the core project structure, test infrastructure, and workspace configuration while adding support for CocoaPods and Swift Package Manager distribution. Additionally, the example project was restructured to demonstrate advanced features and custom UI implementations.

2020 — modular refactoring and feature expansion

10 changes.

The project underwent a significant structural refactoring, reorganizing the Mantis library into modular components to support advanced features like perspective skew correction, undo/redo functionality, and high-bit-depth image processing. This period also introduced comprehensive localization for 13 languages, expanded crop mask shapes, and established robust support for Swift Package Manager and Carthage integration alongside extensive unit testing.

2021–2025 — SwiftUI integration and component extensibility

5 changes.

This period focused on introducing a modern, declarative SwiftUI API for the Mantis image-cropping library, featuring session-based state management and a new example application. It also expanded the library's extensibility through a protocol-based architecture and added advanced, themable rotation controls including a new RotationDial and an Apple Photos-style SlideDial with skew adjustments.

Features

Added Swift Package Manager workspace configuration

A new workspace configuration file has been added to the .swiftpm directory, enabling the project to be opened and built as a Swift Package in Xcode. This change allows developers to integrate the package directly into their Xcode projects or workspaces using the Swift Package Manager tooling.

.swiftpm · high confidence

Added Xcode schemes for Swift Package Manager and Carthage support

New Xcode scheme files have been added to the project to support integration via Swift Package Manager (Mantis-Package.xcscheme) and Carthage (Mantis.xcscheme). These schemes configure the build, test, and launch actions for the Mantis framework and its test bundle, enabling developers to build and test the library using these package managers.

Mantis.xcodeproj/xcshareddata · high confidence

Added localization support for 13 languages

The Mantis resource bundle now includes localized string files for Arabic, German, English, Spanish, French, Italian, Japanese, Korean (both standard and KR variants), Dutch, Portuguese (Portugal), Russian, Turkish, Simplified Chinese, and Traditional Chinese. This enables the application's UI elements—such as Done, Cancel, Reset, Original, Square, Change Crop, and Reset Changes—to display in the user's preferred language.

Sources/Mantis/Resources · high confidence

Introduce new RotationDial component with configurable theming and orientation

A new RotationDial view is added to the Mantis module, providing a circular rotation control with a dial plate, pointer, and angle indicators. The component supports multiple orientations (normal, left, right, upside down) and includes a theming system that allows users to switch between dark and light modes, automatically adjusting colors for scales, indicators, and numbers. It also exposes configuration options for margins, scale spacing, and rotation center type, enabling flexible integration into image editing workflows.

Sources/Mantis/RotationDial/RotationDial · high confidence

Introduces configurable visual effects and new crop mask shapes for the background dimming layer

The \Sources/Mantis/MaskBackground\ module now supports customizable background visual effects and additional crop shapes. Users can select from new \CropVisualEffectType\ options (such as \.blurDark\, \.blurSystem\, \.light\, and \.none\) to control the appearance of the dimming overlay, with \.blurSystem\ automatically adapting to light and dark mode. Additionally, the crop mask area now supports more shapes, including rounded rectangles, diamonds, hearts, and polygons, allowing for more flexible cropping interfaces.

Sources/Mantis/MaskBackground · high confidence

Introduces protocol-based architecture for Mantis crop components

The library now exposes a set of new protocols (such as CropViewProtocol, CropToolbarProtocol, and CropViewControllerDelegate) that define the interfaces for the cropping view, toolbar, and view controller. This change decouples the concrete implementations from their contracts, allowing developers to provide custom implementations for core components like the crop view, toolbar, and rotation controls, thereby enabling deeper customization of the UI and behavior beyond the default settings.

Sources/Mantis/Protocols · high confidence

Mantis 3.1.0 release with crop persistence and iOS 15 minimum

This release introduces Mantis version 3.1.0, establishing iOS 15 as the minimum deployment target and adding a \.swift-version\ file to enforce Swift 5.0. The primary feature is cross-session crop persistence: \CropInfo\ now conforms to \Codable\, allowing users to save and restore exact crop states (including rotation, perspective skew, and fixed ratios) across app launches. The release also includes updated documentation in the README and CHANGELOG, and adjusts the \.gitignore\ to exclude \Pods/\ and AI context files.

(repo-wide) · high confidence

New Apple Photos-style rotation dial with Straighten, Vertical Skew, and Horizontal Skew controls

The SlideDial component now supports an Apple Photos-style interface (configurable via \SlideDialMode.withTypeSelector\) that replaces the simple angle indicator with three circular type-selector buttons for Straighten, Vertical Skew, and Horizontal Skew. This new mode introduces a dedicated type-selector UI where buttons slide to center the active selection, display numeric values when adjusted, and show icons when at zero. The implementation includes a new \SlideDialViewModel\ to store and restore angles independently for each adjustment type, ensuring that switching between types preserves the user's previous adjustments. It also adds \SlideDialIconDrawer\ for rendering the specific adjustment icons and \SlideRulerPositionHelper\ variants to manage the ruler's offset behavior for the new multi-type layout.

Sources/Mantis/RotationDial/SlideDial · high confidence

New SwiftUI example app for Mantis

The repository now includes a complete SwiftUI example project (MantisSwiftUIExample) that demonstrates how to integrate the Mantis image-cropping library in SwiftUI applications. The demo showcases both the modern declarative API (using ImageCropper and CropSession for state-driven cropping with custom toolbars) and the legacy binding-based API (ImageCropperView) for migration reference. It features a comprehensive feature list allowing users to test various cropping options such as different crop shapes (rect, circle, heart, arbitrary paths), aspect ratios, perspective correction, and rotation controls. The app also includes helper views for selecting images from the photo library or camera, and adapts its layout for different screen sizes and orientations.

SwiftUIExample · high confidence

New declarative SwiftUI image cropper with session-based control

SwiftUI users can now crop images using the new \ImageCropper\ view, which offers a declarative API with modifiers for crop shape, aspect ratio, and appearance. This component supports an optional \CropSession\ that allows developers to drive cropping actions (rotate, flip, undo, redo, reset) imperatively from custom UI controls while observing the session's live state (such as \canUndo\ and \transformation\). The update also introduces \CropResult\ to deliver the cropped image and transformation data via a callback, replacing the previous binding-based approach found in the legacy \ImageCropperView\.

Sources/Mantis/SwiftUIView · high confidence

New helper infrastructure for perspective skew, undo/redo, and auto-adjustment

The Mantis helpers module now includes dedicated support for advanced image manipulation features. Perspective skew correction is backed by new math helpers (PerspectiveTransformHelper, SkewPositioning) that compute CATransform3D transforms and handle viewport positioning to mimic Apple Photos behavior. An Undo/Redo system is introduced via TransformStack and TransformRecord, allowing users to revert or reapply crop adjustments within a session. Additionally, ImageAutoAdjustHelper leverages Apple's Vision framework to automatically detect and correct image horizon alignment, while GeometryHelper and Orientation helpers provide foundational utilities for crop box calculations and device orientation handling.

Sources/Mantis/Helpers · high confidence

Behavioural changes

Crop toolbar and view controller refactored into modular extensions with undo/redo support

The CropViewController implementation has been restructured into distinct, focused files (CropToolbar, CropAPI, CropViewDelegate, Layout, ToolbarDelegate, UndoRedo) to improve maintainability. This change introduces a configurable undo/redo system for crop transformations, allowing users to revert or reapply changes during a session. The toolbar UI is now fully customizable via a dedicated config object, supporting options for button visibility, icons, and appearance modes. Additionally, the crop operation now supports both synchronous and asynchronous modes to handle large images more efficiently, and the layout logic has been refined to correctly handle embedded modes and safe area insets on modern iOS versions.

Sources/Mantis/CropViewController · high confidence

CropView refactored into focused extensions with added accessibility and skew support

The CropView implementation has been reorganized into modular Swift extensions (Crop, Flip, Layout, Rotation, Skew) to improve maintainability. This change introduces VoiceOver and Switch Control support for the crop overlay handles via dedicated accessibility helper views, and adds perspective skew correction capabilities that allow users to adjust horizontal and vertical skew angles directly from the rotation control.

Sources/Mantis/CropView · high confidence

Example project restructured with new demo architecture and custom UI components

The Example project has been completely reorganized to demonstrate the library's capabilities. A new \DemoViewController\ serves as the main entry point, featuring a menu for various cropping modes (Normal, Embedded, Transformation, Headless, etc.) and a switch to toggle between standard and large test images. The previous \ViewController\ and \Main.storyboard\ have been replaced. New files demonstrate advanced features: \CustomViewController\ shows how to subclass \CropViewController\ for custom navigation items; \CustomizedCropToolbar\ and \CustomizedCropToolbarWithoutList\ provide examples of implementing \CropToolbarProtocol\ for fully custom toolbars; \CustomWaitingIndicator\ shows how to implement \ActivityIndicatorProtocol\; and \EmbeddedCropViewController\ demonstrates embedded cropping with Undo/Redo support and resolution display. The \AppDelegate\ has also been updated to include a custom menu bar with Undo/Redo/Revert commands for macOS Catalyst support.

Example · high confidence

Initialize Xcode workspace configuration

The project now includes the standard Xcode workspace files (contents.xcworkspacedata, IDEWorkspaceChecks.plist, and WorkspaceSettings.xcsettings). This establishes the basic workspace structure required for the project to open correctly in Xcode, ensuring the IDE recognizes the project reference and applies default workspace settings.

Mantis.xcodeproj/project.xcworkspace · high confidence

Mantis crop library restructured with new configuration and appearance system

The Mantis library has been reorganized into a new modular structure, introducing dedicated configuration structs (Config, CropViewConfig, CropToolbarConfig, CropAuxiliaryIndicatorConfig) that centralize customization options for the crop interface. A new AppearanceMode system (forceDark, forceLight, system) automatically adapts UI colors and visual effects to the user's theme, while new crop shape types (ellipse, circle, roundedRect, diamond, heart, polygon, path) expand the available mask options. The library now supports async cropping for large images, perspective correction with skew adjustments, and undo/redo functionality, with all crop state data made Codable for cross-session persistence.

Sources/Mantis · high confidence

Stabilized image processing with perspective skew support and crash prevention

The image processing pipeline in the Extensions module has been hardened to prevent crashes from invalid dimensions and to support advanced editing features. NaN and infinite values in crop parameters are now guarded against to avoid runtime failures. A new perspective skew correction capability allows users to correct distorted images using a shared CIContext for performance. Additionally, support for high-bit-depth images (10-bit and 16-bit) and indexed color images has been added via improved bitmap context creation and backup logic, ensuring accurate output for complex image formats.

Sources/Mantis/Extensions · high confidence

Test coverage

Comprehensive unit test coverage for Mantis core geometry and UI components; Initial project structure and test infrastructure added.

Dependencies

Add CocoaPods and Swift Package Manager support for Mantis 3.1.0

The Mantis library is now distributable via CocoaPods and Swift Package Manager (SPM). A new Mantis.podspec defines version 3.1.0 with a minimum iOS deployment target of 15.0, while Package.swift configures the SPM package for iOS and Mac Catalyst 15.0, including a privacy manifest (PrivacyInfo.xcprivacy) and localization resources. Example projects (MantisExample and MantisSwiftUIExample) have been updated with Podfiles to consume the local library, enabling users to integrate Mantis into their projects using standard dependency managers.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 60 → 54 (-5.8)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 96 → 95 (-0.5)
  • Architecture 98 → 99 (+1.1)
  • Maturity 55 → 55 (+0.0)
  • Readiness 57 → 43 (-14.3)
  • Security 56 → 56 (+0.0)

Resolved (2)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)

New (5)

  • Ambiguous overloading of 'crop'. CropViewController has two methods named crop: one taking CropInfo and one taking no arguments. This can be confusing for callers who might not realize that the no-argument version uses the current view state, while the other requires explicit info. Additionally, CropSession also has a crop() method. While the contexts differ (ViewController vs Session), the naming overlap across the public API surface for the same conceptual action ('perform the crop') is slightly inconsistent in terms of explicitness.
  • Coverage not measured — Swift suite
  • Inconsistent entry points for the core 'crop' operation. The API exposes a static helper Mantis.swift.crop, an instance method on CropViewController, and an instance method on CropSession. While these serve different architectural purposes (functional vs UI vs State), the naming crop is used in all three without clear differentiation in the method name itself (e.g., Mantis.cropImage, CropViewController.executeCrop, CropSession.performCrop). This forces the user to know which context they are in to use the correct method.
  • Inconsistent parameter naming convention for identical operations. One method uses 'Horizontal' in the parameter name while the other uses 'Vertical', implying a distinction that may not be semantically clear or necessary if the ratio is defined by width/height pairs regardless of orientation. More critically, the naming suggests the parameter refers to the axis, but typically aspect ratios are width/height. If these are meant to be the same operation (setting a ratio), the parameter names should be consistent (e.g., width/height) rather than axis-specific, or the methods should be unified if they do the same thing.
  • Mantis.swift.setupRotationControlViewIfNeeded (cognitive 27) (Sources/Mantis/Mantis.swift)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

guoyingtao/Mantis was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 1 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit decd307ebced09604225b23f88dcf7fe8798ab69 — the exact code this score is about.
  • Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-e569280dd5e2.