Skip to content
CAI
Software that uses CAICheck a score

layoutBox/FlexLayout

63.0

Adequate · 1 October 2026

3.4k

lines of production code

Swift

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

FlexLayout is a Swift library that provides a fluent, CSS-like flexbox interface for iOS UI layout, built on top of the YogaKit engine. It enables developers to define responsive view hierarchies using properties such as direction, gap, and percentage-based sizing, while ensuring thread safety through MainActor isolation. The system includes comprehensive test coverage for layout behaviors and supports integration via both CocoaPods and Swift Package Manager.

How it got here

2017 — Project restructuring and automation

7 changes.

The project underwent significant structural changes, embedding YogaKit sources directly and reorganizing the Xcode workspace to support CocoaPods and sample applications. A comprehensive iOS example app was added to demonstrate layout capabilities, while Fastlane automation was introduced to streamline builds, testing, and deployment processes.

2018–2019 — Swift API and Flexbox feature expansion

5 changes.

This period focused on introducing a native Swift interface for FlexLayout, featuring MainActor isolation and support for modern CSS properties like gap and align-content. The work also integrated YogaKit 2.0 to enhance layout validation, baseline support, and performance, while establishing Swift Package Manager compatibility.

2023–2024 — Test coverage and build infrastructure

5 changes.

This period focused on enhancing the project's reliability and developer experience by adding a comprehensive test suite for FlexLayout behaviors and establishing robust build configurations. Key improvements included introducing a CocoaPods-based example project, relocating public headers for correct exposure, and configuring Xcode workspaces and schemes to support both Swift Package Manager and CocoaPods workflows.

Features

Add FlexLayoutSample iOS example application

The FlexLayoutSample iOS example application has been added, providing a comprehensive suite of UI demonstrations for the FlexLayout library. The app includes an introductory view, basic flexbox layout examples, a self-sizing UICollectionView implementation for displaying house listings, and a detailed recreation of the Ray Wenderlich Yoga tutorial. It also features common utility components such as a base view controller, a custom BasicView for visualizing layout bounds, and image downloading extensions, all structured to showcase how FlexLayout integrates with PinLayout for container positioning.

Example/FlexLayoutSample · high confidence

Initial Fastlane automation for iOS builds and deployment

Added a new Fastfile to automate the iOS build, test, and deployment pipeline. The configuration defines lanes for installing dependencies, running SwiftLint, building the FlexLayoutInner and FlexLayoutSample schemes (including an SPM example), executing unit tests via Scan, generating documentation with Jazzy, and handling CocoaPods podspec versioning and GitHub releases during deployment.

fastlane · high confidence

New CocoaPods-based example project for FlexLayout

The repository now includes a dedicated \FlexLayoutSample\ project located in \Example/cocoapods\, which demonstrates how to integrate FlexLayout using CocoaPods as the dependency manager. This new project file structure, including its Xcode project settings and workspace configuration, complements the existing Swift Package Manager example, providing users with a complete, ready-to-run CocoaPods setup for testing and adopting the library.

Example/SPM, Example/cocoapods · high confidence

Support for new Flexbox properties and SPM compatibility

This update adds support for several new CSS-like Flexbox properties, including \align-content: space-evenly\, \position: static\, \box-sizing\, and \display: contents\. It also introduces the \isFlexEnabled\ property on UIViews to check if FlexLayout is active. Additionally, the library has been refactored to support Swift Package Manager (SPM) by replacing the custom \FLEXLAYOUT\_SWIFT\_PACKAGE\ macro with the standard \SWIFT\_PACKAGE\ define and updating import syntax, while ensuring thread safety with \@MainActor\ isolation for associated objects.

Sources/Swift/Impl · high confidence

Swift implementation of FlexLayout with MainActor isolation and new layout properties

This change introduces the Swift source files for the FlexLayout library, providing a native Swift interface for flexbox-based UI layout on iOS. The core \Flex\ class is now isolated to the \@MainActor\ to ensure thread safety, and exposes new layout properties including \direction\, \gap\, \border\, \cornerRadius\, and \contents\ display mode. It also adds support for percentage-based sizing via a new \FPercent\ struct and postfix \%\ operator, and integrates with the Yoga layout engine through \YGLayoutExtensions\ to handle value conversions. Users can now define layouts using a fluent Swift API that mirrors CSS flexbox concepts.

Sources/Swift · high confidence

YogaKit integration with layout validation and baseline support

This change introduces the YogaKit source files (UIView+Yoga.mm and YGLayout.mm) into the project, enabling the use of the Yoga layout engine for iOS views. The implementation includes validation for node mutations (markDirty, SetMeasureFunc) to prevent invalid states, adds support for baseline measurement (specifically for UILabels), and ensures pixel-perfect rendering by rounding intrinsic size values and handling NaN dimensions to prevent crashes. It also restores the ability to move views between superviews and configures the global Yoga config with web flex basis and classic errata settings.

Sources/YogaKit · high confidence

Behavioural changes

Added FlexLayoutInner build scheme

A new Xcode scheme named 'FlexLayoutInner' has been added to the project configuration. This scheme is configured to build the FlexLayout.framework and run the FlexLayoutTests.xctest target, providing a dedicated build configuration for this specific component.

FlexLayout.xcodeproj/xcshareddata · high confidence

Added workspace check configuration

The workspace now includes an IDEWorkspaceChecks.plist file that enables the 'IDEDidComputeMac32BitWarning' check. This configuration ensures that Xcode displays a warning if any framework or library within the workspace is compiled for a 32-bit architecture, helping to maintain a 64-bit-only build target.

FlexLayout.xcworkspace/xcshareddata · high confidence

FlexLayout project structure updated to include YogaKit sources and new test suites

The FlexLayout Xcode project has been restructured to embed the YogaKit source code directly (including \YGLayout.mm\ and \UIView+Yoga.mm\) rather than relying solely on external dependencies, and new unit test files for Inset, Width/Size, Padding, Margin, and JustifyContent have been added to the test target.

FlexLayout.xcodeproj · medium confidence

Public header file relocated to Sources/Swift/Public

The \FlexLayout.h\ public header has been moved to the \Sources/Swift/Public\ directory. This change ensures that the framework's public interface, including imports for \UIView+Yoga\, \YGLayout+Private\, and the Yoga library headers, is correctly exposed for iOS projects using library path includes.

Sources/Swift/Public · medium confidence

Workspace restructured to include CocoaPods sample app and Pods project

The FlexLayout workspace has been updated to reference the FlexLayoutSample project (located in Example/cocoapods) and the generated Pods.xcodeproj, establishing the configuration for the CocoaPods-based sample application.

FlexLayout.xcworkspace · high confidence

YogaKit 2.0 public header update with boxSizing and gap support

The YogaKit headers in Sources/YogaKit/include have been updated to version 2.0, introducing support for the \boxSizing\ property and the \gap\ function (including \columnGap\, \rowGap\, and \gap\) on the \YGLayout\ class. The public API now exposes \UIView+Yoga\ with a \configureLayoutWithBlock\ method for performance optimization in Objective-C, and \YGLayout\ properties are fully defined in the new public headers, replacing previous internal or private declarations.

Sources/YogaKit/include · high confidence

Fixes

Added Xcode workspace configuration for Swift Package Manager

A new \contents.xcworkspacedata\ file has been added to the \.swiftpm/xcode/package.xcworkspace\ directory. This file defines an Xcode workspace that references the local package, enabling developers to open and build the Swift package directly within Xcode.

.swiftpm · high confidence

Test coverage

Added comprehensive test suite for FlexLayout layout behaviors

Added new XCTest files in the Tests directory to verify FlexLayout functionality, including tests for view insertion and removal, inset positioning (relative, absolute, and static), content justification, margins, padding (including percentage-based values), and width/height sizing constraints.

Tests · high confidence

Dependencies

FlexLayout 2.2.3 release with Yoga 3.2.1 and iOS 13.4 minimum

This release updates the FlexLayout library to version 2.2.3, integrating the Yoga layout engine at version 3.2.1. The minimum supported iOS platform has been raised to 13.4, and the package now requires the C++20 language standard for compilation. These changes are reflected in the updated Podspec, Package.swift, and resolved dependency files.

(dependencies) · high confidence

Housekeeping

Added user-specific Xcode scheme configuration; Initial workspace configuration for FlexLayout.

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 64 → 63 (-0.8)
  • Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.

Lenses

  • Code Health 98 → 98 (+0.0)
  • Architecture 89 → 97 (+7.3)
  • Maturity 52 → 52 (+0.0)
  • Readiness 59 → 57 (-1.8)
  • Security 80 → 80 (+0.0)

Resolved (3)

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

New (7)

  • Ambiguous method names horizontally, vertically, and all. These methods do not specify whether they apply to margin, padding, or position. Given the context of other methods like marginHorizontal and paddingHorizontal, it is unclear if horizontally is a shorthand for marginHorizontal or paddingHorizontal or both. This is a significant naming inconsistency and potential source of bugs.
  • Coverage not measured — Swift suite
  • Documentation: no installation or build instructions (docs/1.1/docsets/FlexLayout.docset/Contents/Resources/Documents/index.html)
  • Documentation: no usage examples (docs/1.1/docsets/FlexLayout.docset/Contents/Resources/Documents/index.html)
  • Inconsistent naming for child addition. addItem is used for adding children, but there is no removeItem or removeChild visible in the list (though not shown, it's implied by the pattern). More importantly, define is used for configuration blocks, which is distinct. However, addItem vs addChild is a common inconsistency. If addItem is the standard, ensure no addChild exists. In this list, only addItem is present, so this is not an inconsistency within the list, but addItem is a generic name. A more significant issue is the lack of symmetry if remove methods are named differently (e.g., removeItem vs removeChild). Since only addItem is shown, this is a minor point, but the name addItem is less semantic than addChild for a layout container.
  • MethodTooLong: Direction.yogaValue (Sources/Swift/FlexLayout.swift)
  • Redundant directional setters vs. unified gap/margin/padding setters. The API provides specific methods for left, right, top, bottom, start, and end, but also provides marginHorizontal, marginVertical, paddingHorizontal, paddingVertical, and horizontally/vertically/all. While left/right etc. are for position and margin/padding are for spacing, the naming convention is inconsistent. Specifically, horizontally and vertically are ambiguous compared to marginHorizontal/paddingHorizontal. Furthermore, left/right/top/bottom are absolute positioning, while start/end are logical positioning. Mixing these without clear distinction or a unified position object (which exists but is less ergonomic for simple values) creates cognitive load.

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

Survey your own repository

layoutBox/FlexLayout 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 320a19f1e842f335f0d636dd810e07498eae9f0b — 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.