Skip to content

[iOS] Isolate Constrainable layout operations - #190

Merged
brynbodayle merged 4 commits into
airbnb:masterfrom
jqsilver:ab-constrainable-isolation
Oct 23, 2026
Merged

brynbodayle merged 4 commits into
airbnb:masterfrom
jqsilver:ab-constrainable-isolation

Conversation

@jqsilver

@jqsilver jqsilver commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Change summary

Isolate Constrainable anchors, frames, owning views, installation, and layout helpers to the main actor. Keep identity, equality, container diffing, and model construction nonisolated. Declare nonisolated UIKit/group/spacer conformances on Swift 6.2+ with compiler-guarded fallbacks for older compilers. Mark spacer style Sendable for immutable style equality. Add compiler contracts and adapt existing Quick tests at layout invocation boundaries.

Context

Inferred main-actor conformances can otherwise leak into GroupItem<UIView> and group/spacer model construction. Isolating the entire protocol also isolates value wrappers used for diffing. This follows the focused direction discussed in #185: constrain layout operations while preserving nonisolated identity and equality. It retains tools version 5.5 and iOS 13 and does not apply package-wide default isolation or isolate the whole Group protocol.

How was it tested?

  • Wrote automated compiler contracts for nonisolated generic/subclass model construction, concrete/existential identity and equality, container diffing, and main-actor layout. Off-actor installation, frame and anchor access are each rejected.
  • Ran locally: bash Tests/CompilerTests/check-constrainable.sh /tmp/epoxy-validation/layout-derived/Build/Products/Debug-iphonesimulator. Passes in Swift 5 and Swift 6 language modes with complete concurrency, InferIsolatedConformances, and warnings as errors.
  • Ran locally: xcodebuild build -scheme EpoxyLayoutGroups -destination 'generic/platform=iOS Simulator' -derivedDataPath /tmp/epoxy-validation/layout-derived -clonedSourcePackagesDirPath /tmp/epoxy-validation/layout-packages SWIFT_STRICT_CONCURRENCY=complete OTHER_SWIFT_FLAGS='$(inherited) -enable-upcoming-feature InferIsolatedConformances' CODE_SIGNING_ALLOWED=NO.
  • Built and ran on the iOS simulator: 40 existing group/model/container tests passed on iPhone 16 / iOS 27.0 with Swift 6.4. The generated Epoxy-Package test scheme used a temporary package with Sources and Tests symlinked to this branch; Quick 4.0.0 and Nimble 9.2.1, without dependency-file changes.
  • Full Epoxy package builds in the default configuration.
  • Changed Swift files pass the repository's SwiftFormat and SwiftLint configurations.
  • Ran on CI / Xcode 16.4. The older-compiler fallback remains unverified locally because only Swift 6.4 is installed.

Validation limit: a full-package build with complete concurrency and InferIsolatedConformances fails in unchanged CollectionViewScrollToItemHelper.swift:176; the same failure was reproduced on master. The isolated layout-module build succeeds with other existing concurrency warnings, while the consumer fixtures are warning-free.

This changes compile-time layout access requirements; there is no intended visual change. Callers performing layout through Constrainable must run on the main actor. Recent Xcode build products and consumer probes use an effective iOS 15 minimum; Package.swift still declares iOS 13.

Pull request checklist

  • No runtime feature flag is needed for this layout isolation contract.
  • Added a CHANGELOG.md entry in the Unreleased section.

Please Review

@brynbodayle cc @andreacipriani

@jqsilver

Copy link
Copy Markdown
Contributor Author

This one's failing CI job also seems to be a simulator issue.

@jqsilver
jqsilver marked this pull request as ready for review October 20, 2026 19:09
@brynbodayle
brynbodayle merged commit c57bb69 into airbnb:master Oct 23, 2026
7 checks passed
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