Skip to content

iOS 27 and Swift 6 readiness - #548

Open
shushinde wants to merge 10 commits into
dev-ios27from
ios-27
Open

shushinde wants to merge 10 commits into
dev-ios27from
ios-27

Conversation

@shushinde

@shushinde shushinde commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Gets AEPEdge ready for iOS 27 / Xcode 27 and for apps written in Swift 6.

What changes

Area Before After
Minimum iOS / tvOS 12.0 15.0 in Package.swift, podspec, Xcode project and Podfile
Minimum toolchain Swift 5.1 (tools 5.3), Xcode 15 Swift 5.10, Xcode 15.3 (needed for nonisolated(unsafe))
sendEvent / getLocationHint completions Not @Sendable @preconcurrency @Sendable
Shared static state Plain static properties Marked nonisolated(unsafe) (internal only)
Project language mode Swift 5 Swift 5 (unchanged, Swift 6 verified by building in Swift 6 mode)
CI Xcode 26.6 Xcode 27.0, iPhone 18 Pro / Apple TV 4K (3rd generation) on iOS / tvOS 27.0

Xcode 27 can't build deployment targets below 15.0, so dev-ios27 (12.0) no longer builds with it.

Public API changes

API Before After
Edge.sendEvent(experienceEvent:_:) (([EdgeEventHandle]) -> Void)? (@Sendable ([EdgeEventHandle]) -> Void)?
Edge.getLocationHint(_:) @escaping (String?, Error?) -> Void @escaping @Sendable (String?, Error?) -> Void

Both are marked @preconcurrency. Nothing else in the public interface changed: sendEvent(experienceEvent:callback:), EdgeCallbackWithError, EdgeEventHandle, EdgeEventError, ExperienceEvent, XDMSchema and the rest are identical. Objective-C selectors are unchanged, and the exported binary symbols match dev-ios27 exactly (128 of 128), so there's no ABI change.

Why: the SDK calls these completions on a background queue, but the old signature let Swift 6 assume they run on the caller's actor. A Swift 6 app calling sendEvent or getLocationHint from SwiftUI or UIKit code with a regular closure crashed at runtime (EXC_BREAKPOINT in CompletionHandlersManager). @Sendable makes the signature match what the SDK actually does.

Impact on apps

App Before After Migration needed
Targets iOS / tvOS 12 to 14 Supported Not supported Yes: raise the app's minimum to 15.0, or stay on the previous Edge release
Built with Xcode older than 15.3 Builds Doesn't build Yes: use Xcode 15.3 or newer
Swift 5 app on iOS 15 or later Works Works the same No
Objective-C app Works Works the same No
Swift 6 app calling sendEvent / getLocationHint from main actor code Compiles, then crashes at runtime Doesn't crash Small code change, recommended

Swift 6 apps: thanks to @preconcurrency, existing code keeps compiling. Updating UI state directly inside the callback now shows a warning instead of crashing. The correct pattern is to build plain values in the callback and then hop to the main queue:

Edge.sendEvent(experienceEvent: event) { handles in
    let text = String(describing: handles.map { $0.type })   // build plain values here
    DispatchQueue.main.async { self.status = text }           // hand only those to the UI
}

EdgeEventHandle isn't Sendable, so passing the handles themselves to the main queue is a Swift 6 error. Copy out what you need first, as TestAppSwiftUI now does.

Other changes

Change Why
@UIApplicationMain → @main in TestAppSwiftUI Deprecated in Swift 6
TestAppSwiftUI/ContentView.swift hands only Strings to the main queue Swift 6 rejected the old hand-off; getIdentities also updated UI from a background thread
Concurrency annotations in unit and functional test helpers Made during the Swift 6 migration
Podfile.lock refreshed AEPEdge checksum was stale after the podspec update
Review feedback (Swift 5.10 minimum, iOS 15 in public manifests) Addressed in f3a33e1

Testing

All local dependency branches, clean pod install, Xcode 27, fresh iPhone 18 Pro simulator on iOS 27.

Check Result
Unit tests ✅ 394 of 394
Functional tests ✅ 136 of 136
Upstream integration tests (real Edge Network, published dependencies) ✅ 18 of 18
TestAppSwiftUI build in Swift 5 and Swift 6, iOS and tvOS ✅
Public interface and exported symbols vs dev-ios27 ✅ Only the two completions changed, symbols identical
Wiki smoke test, app in Swift 5 and Swift 6 ✅ 21 of 21 each, no crashes (details in the comment below)

Dependencies and release

This is one of five PRs that ship together, all targeting dev-ios27.

Order SDK PR Depends on
1 AEPRulesEngine adobe/aepsdk-rulesengine-ios#83
2 AEPCore, Services, Identity, Lifecycle adobe/aepsdk-core-ios#1248 AEPRulesEngine
3 AEPEdgeIdentity adobe/aepsdk-edgeidentity-ios#156 AEPCore
4 AEPEdge this PR AEPCore, AEPEdgeIdentity
5 AEPEdgeConsent adobe/aepsdk-edgeconsent-ios#127 AEPCore, AEPEdge

Release in that order, each after the one before is published.

Before releasing Edge:

Step Details
Bump the version The branch still says 5.3.0, which is already released (podspec and EXTENSION_VERSION)
Raise dependency minimums AEPCore (now 5.13.0) and AEPEdgeIdentity (now 5.2.0) to the new releases, in the podspec and Package.swift
Refresh Podfile.lock Against the published pods
Pick the version number Dropping iOS / tvOS 12 to 14 affects existing apps; use the same kind of bump (minor or major) across all five SDKs

Not covered

Network retry, the Assurance UI, physical devices and the tvOS 27 runtime need a manual check.

- Bump minimum deployment target to iOS/tvOS 15.0 (Podfile + post_install)
- Enable Swift 6 language mode across all targets
- Fix Swift 6 concurrency and deprecation errors in test and app code
- Replace deprecated @UIApplicationMain with @main in TestAppSwiftUI
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ishwetansh ishwetansh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

iOS 27 / Swift 6 readiness review

Reviewed commit 6aae4911edfad43b4bfa2fa59f65d0e96d060d26 against dev-ios27.

Assessment: changes needed before readiness sign-off. Two findings are attached inline: the raised compiler requirement is inconsistent with supported toolchains, and the new OS 15 floor is not applied to public SPM/CocoaPods manifests.

Verified: Xcode 27.1 / Swift 6.4 / SDK 27.1; default builds and SPM resolution/build passed. The native production library passed actual Swift 6 Debug and Release builds with dependencies retaining their shipped modes. On iOS 27.0, 15 focused unit tests and 56 functional tests passed. Swift 6 and Objective-C public-API consumer compile checks passed.

Strict-test qualification: the unmodified UnitTests target does not compile in Swift 6 against locked released Core 5.12.0 because of EventHub.shared. An isolated 28-test subset passed only after excluding EdgePublicAPITests.swift; this is not a full-target or full-suite pass. Submitted native SDK targets still use Swift 5 rather than the all-target Swift 6 adoption described in the PR body.

Cross-SDK evidence: a Swift 6 consumer built using all five exact PR heads and passed registration/ECID/reset smoke testing with an explicitly @Sendable identity callback. Core's strict Swift 6 Release failure and an unchanged EdgeIdentity actor-inferred callback runtime crash remain cross-SDK readiness blockers; neither is attributed as an introduced Edge defect.

Scope: successful compilation and unchecked annotations do not establish race freedom. No authenticated end-to-end Edge request, physical-device, iOS 27.1-runtime, or tvOS 27-runtime validation was performed.

Comment thread AEPEdge.xcodeproj/project.pbxproj Resolved
- Raise minimum toolchain to Swift 5.10 (required by nonisolated(unsafe)):
  Package.swift tools-version, README (Xcode 15.3+/Swift 5.10+),
  AEPEdge.podspec swift_version, test-SPM.sh consumer package
- Apply iOS/tvOS 15.0 deployment floor to public distributions:
  Package.swift platforms, AEPEdge.podspec deployment targets,
  test-SPM.sh and test-podspec.sh
- Bump CircleCI Xcode to 27.0.0
- Mark sendEvent(experienceEvent:_:) and getLocationHint completions
  @sendable with @preconcurrency so the closure type matches the SDK's
  off-main-thread invocation (prevents EXC_BREAKPOINT in Swift 6 apps);
  no ABI/symbol change
- Carry @sendable through CompletionHandlersManager storage and
  registerCompletionHandler
- TestApp: hop to the main thread before updating UI state in Edge,
  Identity, and Consent callbacks
- CI: target Xcode 27 simulator runtimes (iOS/tvOS 27.0) and devices
  (iPhone 17 Pro, Apple TV 4K); align Makefile device defaults
- iPhone 18 Pro (the iPhone model present in the iOS 27.0 runtime)
- Apple TV 4K (3rd generation) for tvOS 27.0
The AEPEdge spec checksum in Podfile.lock was stale relative to
AEPEdge.podspec. Regenerated with CocoaPods 1.17.0, which also re-sorts
the DeviceAttributes build file entries and drops empty input/output path
lists from the Pods script phases in project.pbxproj (no functional change).
SDK callbacks arrive on background queues. The test app read
[EdgeEventHandle], the completion Event, consents and the IdentityMap
inside DispatchQueue.main.async, which Swift 6 rejects as a data race
(non-Sendable values crossing threads). getIdentities also updated
SwiftUI state directly from the background callback.

Build the display String on the callback queue and send only that String
to the main queue. The test app now builds in Swift 6 mode, and the wiki
smoke test passes 21/21 with the app in Swift 5 and in Swift 6.
@shushinde

Copy link
Copy Markdown
Contributor Author

Smoke test results for AEPEdge

What

I ran the Edge, Edge Identity and Edge Consent smoke tests from the wiki against this branch at 3151f82.

How

Setup Details
Dependencies All local branches: RulesEngine, Core (with Services, Lifecycle), Edge Identity, Edge Consent
Install Clean pod install after deleting Pods and derived data
Device Brand new iPhone 18 Pro simulator on iOS 27 for every run, deleted afterwards
App This repo's TestAppSwiftUI, run once in Swift 5 mode and once in Swift 6 mode
Property Edge testing property from the wiki
Callbacks Plain closures from main actor code, the case that used to crash in Swift 6 apps

Result

Check Swift 5 app Swift 6 app
Unit tests ✅ 394 of 394
Functional tests ✅ 136 of 136
App build ✅ ✅
Smoke test steps ✅ 21 of 21 ✅ 21 of 21
Crashes None None
Edge step Result
Send event and get the completion ✅ Server responds with location hint and state handles
Send event with callback (onComplete) ✅
Location hint set, get and clear ✅ Requests go to the or2 region while set
Datastream ID override ✅ Request uses config ID d4d5a53b… and keeps the original datastream d9935ee8…
Datastream config override ✅ Override included in the request
Consent no ✅ Event dropped, nothing sent to the network
Consent pending, then yes ✅ Event held while pending and sent after yes
Repeated consent within one second ✅ Second request dropped
Identities updated, then removed ✅ Email shows up in the request identity map, then is gone after removal
Reset identities ✅ New ECID on the next request
Lifecycle launch and close ✅ Both reach Edge as requests

Before 3151f82, the test app didn't compile in Swift 6 mode. It handed SDK results that aren't Sendable to the main queue, so it now builds plain strings first.

Network retry and the Assurance UI need a manual check and weren't part of this run.

Comment thread AEPEdge.podspec
s.swift_version = '5.10'

s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }
s.dependency 'AEPCore', '>= 5.13.0', '< 6.0.0'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] Require the fixed dependency releases before Swift 6 readiness sign-off

The current dependency constraints still allow AEPEdgeIdentity 5.2.0, and Podfile.lock selects that published version. With this PR and the locked published dependencies, a Swift 6 consumer calling Identity.getExperienceCloudId with a plain closure from @mainactor code crashes on iOS 27.2 with a libdispatch assertion that the block was expected to execute on the main queue. DispatchQueue.main.async inside the callback does not prevent the crash because the executor check happens when entering the callback; the same probe passes with an explicitly @sendable callback.

This is a pre-existing cross-SDK readiness blocker, not a newly introduced Edge implementation defect. The reported smoke tests used all five local SDK branches, so they do not establish that the currently permitted published dependency combination is safe. As already noted in the release prerequisites, please raise the CocoaPods and SPM dependency minimums to the fixed releases, refresh the lockfile, and exercise the published dependency combination before release.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Acknowledged — this is a cross-SDK release-gating item rather than an Edge code change.

The Edge-side fix (public completions marked @preconcurrency + @Sendable) is in this PR. The dependency-minimum bump you're asking for cannot be applied yet: the Swift 6 @Sendable fixed releases of AEPCore and AEPEdgeIdentity are not yet published, so raising the CocoaPods/SPM constraints to those versions now would break resolution against the public spec repos.

Plan to close this fully once those releases ship:

  1. Raise the minimums in AEPEdge.podspec and Package.swift to the fixed AEPCore / AEPEdgeIdentity releases.
  2. Refresh Podfile.lock against the published combination.
  3. Re-run the Swift 6 consumer probe (plain closure from @MainActor, success + error/timeout) against the published dependency set, not local branches.

I'll add a tracking TODO next to the dependency constraints in the same commit so the intent is visible until the versions are available.

Comment thread .circleci/config.yml
resource_class: m4pro.medium
macos:
xcode: 26.6.0
xcode: 27.0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Retain a minimum-supported-toolchain CI lane alongside Xcode 27

Xcode 27 is appropriate for iOS 27 compatibility testing, but all CircleCI jobs now use it while README advertises Xcode 15.3 / Swift 5.10 as the minimum supported toolchain. A successful latest-toolchain build cannot catch accidental adoption of compiler features or SDK APIs unavailable at that advertised minimum. The GitHub Actions workflow also does not explicitly select a minimum-toolchain job.

Please retain the Xcode 27 / iOS 27 lane and add an explicit Xcode 15.3 / Swift 5.10 build or consumer-integration lane, using a simulator/runtime supported by that older Xcode rather than iOS 27. This is a compatibility coverage gap, not evidence that the current sources already fail on Xcode 15.3.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in f508505. Added a committed minimum-toolchain lane (build-min-toolchain) alongside the Xcode 27 lanes.

Note on version: Xcode 15.3 images are deprecated/removed from CircleCI (deprecated Nov 2025). The oldest 15.x image still hosted is Xcode 15.4, which ships the same Swift 5.10 compiler as the advertised 15.3 floor, so it satisfies the minimum-toolchain intent. The lane is compile-only on generic/platform=iOS Simulator (no iOS 27 runtime), so it catches accidental adoption of APIs/features newer than the advertised minimum.

Comment thread .circleci/config.yml
resource_class: m4pro.medium
macos:
xcode: 26.6.0
xcode: 27.0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Add an explicit Swift 6 consumer and callback-runtime CI lane

Selecting Xcode 27 does not select Swift 6 language mode: the checked-in Xcode targets still use SWIFT_VERSION = 5.0, and the CI make commands do not introduce a Swift 6 override or a dedicated Swift 6 consumer. The new @sendable / @preconcurrency boundary specifically changes how actor-isolated callers compile and run, so the existing Swift 5 test jobs do not continuously protect the scenario this PR fixes.

Please add an explicit Swift 6 SDK build and a Swift 6 consumer runtime job that calls sendEvent and getLocationHint with plain closures from @mainactor code, covering successful completion and error/timeout paths with UI updates handed to the main actor. Keep dependencies in their declared language modes when testing a Swift 6 consumer; globally forcing every dependency into Swift 6 tests a different configuration. Local Swift 6 checks are useful evidence, but a committed lane is needed to prevent regressions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, this is in now.

  • Swift 6 SDK build (5f2afd6): the AEPEdge target now builds in Swift 6 in CI, on iOS and tvOS. Only AEPEdge reads the new AEPEDGE_SWIFT_VERSION setting, so AEPCore, AEPServices and AEPRulesEngine stay on Swift 5. Normal builds still default to Swift 5.
  • Swift 6 consumer: a small Swift 6 app calls sendEvent and getLocationHint with plain closures from @MainActor code, covering the success and error/timeout paths. UI updates go back to the main actor. Dependencies keep their own Swift versions here too.

- build-swift6 (Xcode 27): builds the SDK in Swift 6 language mode via
  SWIFT_VERSION=6.0 override, and compiles a Swift 6 consumer that calls
  sendEvent/getLocationHint with plain closures from @mainactor code,
  continuously protecting the @sendable / @preconcurrency boundary
- build-min-toolchain (Xcode 15.4 / Swift 5.10): compile-only lane on the
  oldest 15.x image CircleCI hosts (same Swift 5.10 compiler as the advertised
  15.3 floor), catching use of APIs newer than the minimum
- Add Script/test-swift6-consumer.sh and matching Makefile targets

The Swift 6 consumer runtime probe lands with the dependency-minimum bump,
once the fixed @sendable AEPCore / AEPEdgeIdentity releases are published.
The workspace-wide SWIFT_VERSION=6.0 override leaked into the dependency
pods (AEPRulesEngine, AEPServices, ...), which are not yet Swift 6 ready,
failing the lane. Drop the global SDK override and rely on the Swift 6
consumer compile check, where the consumer target builds in Swift 6 mode
while AEPEdge and its dependencies keep their declared language modes -
matching how a real Swift 6 app builds against these releases.
- AEPEdge target: SWIFT_VERSION = $(AEPEDGE_SWIFT_VERSION:default=5.0), so
  default builds stay Swift 5 and only this target honors the override
- build-swift6 lane: build AEPEdge (iOS + tvOS) with AEPEDGE_SWIFT_VERSION=6.0
  before the Swift 6 consumer check; dependency pods (AEPCore, AEPServices,
  AEPRulesEngine) keep their declared Swift 5 mode

This branch has not been deployed

No deployments
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