Skip to content

♻️ Add @MainActor to AddressMapViewDelegate - #1454

Merged
starv merged 1 commit into
masterfrom
refactor/mainactor-addressmapviewdelegate
Jul 24, 2026
Merged

♻️ Add @MainActor to AddressMapViewDelegate#1454
starv merged 1 commit into
masterfrom
refactor/mainactor-addressmapviewdelegate

Conversation

@starv

@starv starv commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Why?

Part of the Swift 6 strict concurrency migration of the NMP iOS codebase's app-modules/ targets (finn/ios-app#10447). AddressMapViewDelegate carries no isolation, so a @MainActor-isolated consumer in ios-app
(AddressViewController in the Maps module) can only conform to it with @preconcurrency, which leaves a residual warning that can't be resolved downstream.

Same idea as #1453 (@Sendable on image-loading handlers), applied to a delegate protocol, and also in response to Robin's reply on PR #10537 in the iOS-app repo.

What?

Annotates AddressMapViewDelegate as @MainActor.

This is sound because AddressMapView is a UIView subclass (implicitly @MainActor) and every delegate call site already runs on the main actor. The annotation just makes the type system reflect where the protocol is actually used.

The only conformer in this repo — AddressMapDemoView — is already a UIView subclass (implicitly @MainActor), so no conformance changes are needed. The FullscreenViewTests snapshot test is already @MainActor and is unaffected.

Verified downstream by building FINN NMP against a local FinniversKit checkout with this change: AddressViewController conforms cleanly with its @preconcurrency removed, and nothing else in the app regresses.

Version Change

Patch: additive isolation annotation, no runtime behavior change. @MainActor on a delegate protocol is technically source-breaking for any conformer in a nonisolated context, but the only conformer (internal demo) is already main-actor isolated.

UI Changes

None.

AddressMapView is a UIView subclass (implicitly @mainactor) and every
delegate call site runs on the main actor. Annotating the protocol
@mainactor reflects that reality and lets @MainActor-isolated conformers
(e.g. AddressViewController in finn/ios-app) conform without
@preconcurrency, part of the Swift 6 strict concurrency migration
(finn/ios-app#10447).

The sole conformer in this repo (AddressMapDemoView, a UIView subclass)
is already main-actor isolated, so no conformance changes are required.
@starv
starv merged commit 00a3ec4 into master Jul 24, 2026
1 check passed
@starv
starv deleted the refactor/mainactor-addressmapviewdelegate branch July 24, 2026 09:19
starv added a commit that referenced this pull request Jul 30, 2026
…fig statics nonisolated(unsafe) (#1455)

Both changes let consumers drop @preconcurrency escape hatches when
building under the StrictConcurrency upcoming feature flag.

AdRecommendationsGridViewDataSource traffics exclusively in
UICollectionView, UICollectionViewCell and IndexPath, and every call site
is inside AdRecommendationsGridView (a UIView), so it is already
main-actor in practice. Follows the same pattern as #1454.

Config.imageProvider and Config.isDynamicTypeEnabled are set once during
app startup and read-only afterwards, so nonisolated(unsafe) describes
the existing contract without changing any call site.
starv added a commit that referenced this pull request Aug 5, 2026
…#1456)

HappinessRatingView and TextView are UIView subclasses (implicitly
@mainactor) and every delegate call site runs on the main actor —
TextView's five callbacks are all invoked from UITextViewDelegate, which
the SDK already isolates. Annotating the protocols @mainactor reflects
that reality and lets @MainActor-isolated conformers (HappinessRatingViewController
and TextInputFeedbackViewController in finn/ios-app's Feedback module)
conform without @preconcurrency, part of the Swift 6 strict concurrency
migration (finn/ios-app#10447). Follows the same pattern as #1454/#1455.

All conformers in this repo are UIView subclasses and therefore already
main-actor isolated, so no conformance changes are required:
HappinessRatingDemoView, FavoriteAdCommentInputView, AdReporterView and
TextViewDemoView. TextViewDelegate's default implementations inherit the
protocol's isolation and need no annotation.

Also annotates the private RatingViewDelegate, which HappinessRatingView
already satisfies with main-actor-isolated methods — free to fix now, and
it would otherwise warn once FinniversKit itself enables StrictConcurrency.
starv added a commit that referenced this pull request Aug 7, 2026
…irmationViewDelegate (#1457)

All three protocols are main-actor in practice: RadioButton, AdReporterView and ConfirmationView are UIView subclasses, and every delegate call site is inside them. Annotating the protocols lets @mainactor conformers satisfy them without the "conformance crosses into main actor-isolated code" warning under StrictConcurrency.

Continues the work in #1453, #1454, #1455 and #1456.
starv added a commit that referenced this pull request Aug 11, 2026
…rizontalSlideTransitionDelegate (#1459)

All three protocols are main-actor in practice: FeedbackView and InfoboxView are UIView subclasses and every delegate call site is inside them, and HorizontalSlideTransition only invokes its delegate from a UIPresentationController callback. Annotating the protocols lets @mainactor conformers satisfy them without the "conformance crosses into main actor-isolated code" warning under StrictConcurrency.

The internal HorizontalSlideControllerDelegate is annotated too, because it is not optional here: HorizontalSlideTransition is a plain NSObject whose HorizontalSlideControllerDelegate witness is what forwards to the now-main-actor HorizontalSlideTransitionDelegate. Isolating only the public protocol would make that forwarding call an error inside FinniversKit. Its only caller is HorizontalSlideController, a UIPresentationController subclass, so it is already on the main actor.

Continues the work in #1453, #1454, #1455, #1456 and #1457.
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.

3 participants