Skip to content

Conversation

@novinfard
Copy link
Contributor

@novinfard Soheil Novinfard (novinfard) commented Nov 5, 2025

DON-2163 Add explicit import for SPM support and avoid @_exported attribute

This PR adds explicit import statements across multiple files to improve compatibility with Swift Package Manager (SPM) builds. It replaces the experimental @_exported import attribute with standard imports for better maintainability and consistency.

…ttribute

Added conditional imports for BackpackTokens across multiple files to support Swift Package builds. Updated import statements from @_exported to standard imports for consistency and removed unnecessary Foundation imports in UIKit-based files. Also updated Package.swift to include BackpackTokens as a dependency for Backpack_SwiftUI.
@novinfard Soheil Novinfard (novinfard) changed the base branch from donburi/DON-2163-add-spm-support-uikit-swift to main November 5, 2025 16:43
@novinfard Soheil Novinfard (novinfard) changed the base branch from main to donburi/DON-2163-add-spm-support-uikit-swift November 6, 2025 14:33
Base automatically changed from donburi/DON-2163-add-spm-support-uikit-swift to main November 6, 2025 16:07
Copilot AI review requested due to automatic review settings November 6, 2025 17:55
Copy link
Contributor

Copilot AI left a comment

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 removes the experimental @_exported import attribute and adds explicit import statements across the codebase to improve Swift Package Manager (SPM) compatibility. The changes replace transitive imports with direct imports, ensuring modules explicitly declare their dependencies.

Key Changes:

  • Removed @_exported attributes from central import files (BackpackUIKitImports.swift, BackpackSwiftUIImports.swift, BackpackCommonImports.swift)
  • Added conditional #if SWIFT_PACKAGE imports for BackpackTokens where needed
  • Added explicit Foundation/UIKit imports to files that previously relied on transitive imports
  • Updated Package.swift to declare BackpackTokens as a direct dependency of Backpack_SwiftUI

Reviewed Changes

Copilot reviewed 36 out of 40 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Package.swift Added BackpackTokens as an explicit dependency for Backpack_SwiftUI target
Backpack/BackpackUIKitImports.swift Removed @_exported attributes, added conditional BackpackTokens import
Backpack-SwiftUI/BackpackSwiftUIImports.swift Removed @_exported attributes from Foundation, SwiftUI, and UIKit imports
Backpack-Common/BackpackCommonImports.swift Removed @_exported attributes from Foundation and UIKit imports
Multiple Skeleton classes Added conditional BackpackTokens imports for SPM builds
Multiple BottomSheet classes Added UIKit and conditional BackpackTokens imports
Multiple Calendar classes Added explicit Foundation imports
Multiple Button classes Added conditional BackpackTokens imports
Carousel/PageViewController files Changed Foundation imports to UIKit imports

* See the License for the specific language governing permissions and
* limitations under the License.
*/

Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The import statement should use conditional compilation for SPM consistency. Consider adding #if SWIFT_PACKAGE wrapper around BackpackTokens import if BPKCarousel uses any token types, similar to other files in this PR.

Suggested change
#if SWIFT_PACKAGE
import BackpackTokens
#endif

Copilot uses AI. Check for mistakes.
*/

// swiftlint:disable indentation_width
import UIKit
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

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

The UIKit import appears unnecessary for a SwiftUI component. SwiftUI color types don't require UIKit. Consider removing this import unless there's a specific UIKit dependency in the implementation.

Suggested change
import UIKit

Copilot uses AI. Check for mistakes.
Cleaned up unnecessary import statements in generated color and icon files to reduce clutter and improve code clarity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai: codex minor Non breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants