Skip to content

Workaround for DISABLE_TRUEDEPTH_API flag#259

Open
olexale wants to merge 7 commits into
masterfrom
feature/hofix-spm-truedepth-api
Open

Workaround for DISABLE_TRUEDEPTH_API flag#259
olexale wants to merge 7 commits into
masterfrom
feature/hofix-spm-truedepth-api

Conversation

@olexale

@olexale olexale commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Fix #258

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses Issue #258 by making TrueDepth/face-tracking code opt-in under Swift Package Manager (Flutter 3.44+), ensuring apps that don’t use face tracking don’t accidentally ship TrueDepth symbols and get rejected in App Store review.

Changes:

  • Switch Swift compilation gating from !DISABLE_TRUEDEPTH_API to ENABLE_TRUEDEPTH_API (default now excludes face tracking).
  • Add SPM-side opt-in in Package.swift via ARKitFaceTrackingEnabled (Info.plist) or ARKIT_FACE_TRACKING_ENABLED (env var), and document the setup in the README.
  • Bump version to 1.4.1 and document the breaking change in the changelog; update the example iOS project to SPM-oriented setup.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents new opt-in model and SPM/CocoaPods enablement steps.
pubspec.yaml Version bump to 1.4.1.
ios/arkit_plugin/Sources/arkit_plugin/SwiftArkitPlugin+configurationCheck.swift Gates face-tracking configuration checks behind ENABLE_TRUEDEPTH_API.
ios/arkit_plugin/Sources/arkit_plugin/Serializers/AnchorSerializer.swift Gates face-anchor serialization behind ENABLE_TRUEDEPTH_API.
ios/arkit_plugin/Sources/arkit_plugin/GeometryBuilders/GeometryBuilder.swift Gates face-geometry creation behind ENABLE_TRUEDEPTH_API.
ios/arkit_plugin/Sources/arkit_plugin/GeometryBuilders/Geometries.swift Gates face-geometry builder behind ENABLE_TRUEDEPTH_API.
ios/arkit_plugin/Sources/arkit_plugin/FlutterArkitView+Initialization.swift Gates face-tracking configuration initialization behind ENABLE_TRUEDEPTH_API.
ios/arkit_plugin/Sources/arkit_plugin/FlutterArkitView+Handlers.swift Gates face-geometry update handler behind ENABLE_TRUEDEPTH_API.
ios/arkit_plugin/Sources/arkit_plugin/ConfigurationBuilders/FaceTrackingConfigurationBuilder.swift Gates face-tracking configuration builder behind ENABLE_TRUEDEPTH_API.
ios/arkit_plugin/Package.swift Adds SPM-time flag definition based on Info.plist/env var detection.
example/ios/Runner/Info.plist Adds ARKitFaceTrackingEnabled opt-in key for the example app.
example/ios/Runner.xcodeproj/project.pbxproj Updates example project references away from CocoaPods and toward SPM artifacts.
example/ios/Podfile Removes CocoaPods Podfile from the example.
example/ios/Flutter/Release.xcconfig Makes Pods xcconfig include optional (#include?).
example/ios/Flutter/Debug.xcconfig Makes Pods xcconfig include optional (#include?).
CHANGELOG.md Adds 1.4.1 entry describing the breaking flag change.
.gitignore Ignores example/ios/Package.swift.
Comments suppressed due to low confidence (2)

ios/arkit_plugin/Sources/arkit_plugin/GeometryBuilders/GeometryBuilder.swift:40

  • When ENABLE_TRUEDEPTH_API is not set (now the default), requesting an "ARKitFace" geometry falls into a silent // error path and returns nil without any actionable diagnostic. Since this path is now common for misconfigured face-tracking apps, emit a clear assertion failure (debug) so developers immediately understand how to enable face tracking.
        case "ARKitFace":
            #if ENABLE_TRUEDEPTH_API
                geometry = createFace(device)
            #else
                // error
            #endif

ios/arkit_plugin/Sources/arkit_plugin/FlutterArkitView+Initialization.swift:116

  • The error text still says "TRUEDEPTH_API disabled" but this PR switches to an opt-in model (ENABLE_TRUEDEPTH_API). Updating the message to point to the new enabling mechanisms (Swift flag / Info.plist key / env var) will make misconfiguration much easier to diagnose.
            #if ENABLE_TRUEDEPTH_API
                configuration = createFaceTrackingConfiguration(arguments)
            #else
                logPluginError("TRUEDEPTH_API disabled", toChannel: channel)
            #endif

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
flutter_additional_ios_build_settings(target)
if target.name == 'arkit_plugin'
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -DENABLE_TRUEDEPTH_API'

func onUpdateFaceGeometry(_ arguments: [String: Any]) {
#if !DISABLE_TRUEDEPTH_API
#if ENABLE_TRUEDEPTH_API

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

Comment thread pubspec.yaml Outdated
Comment on lines +1 to +3
name: arkit_plugin
description: Flutter Plugin for ARKit - Apple's augmented reality (AR) development platform for iOS mobile devices.
version: 1.4.0
version: 1.4.1
Comment thread README.md
Comment on lines +138 to +140
target.build_configurations.each do |config|
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -DENABLE_TRUEDEPTH_API'
end
Comment thread ios/arkit_plugin/Sources/arkit_plugin/GeometryBuilders/GeometryBuilder.swift Outdated
Comment on lines 137 to 141
func onUpdateFaceGeometry(_ arguments: [String: Any]) {
#if !DISABLE_TRUEDEPTH_API
#if ENABLE_TRUEDEPTH_API
guard let name = arguments["name"] as? String,
let param = arguments["geometry"] as? [String: Any],
let fromAnchorId = param["fromAnchorId"] as? String
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.

[iOS][SPM] DISABLE_TRUEDEPTH_API compiler flag is ignored under Swift Package Manager (Flutter 3.44+)

2 participants