-
Notifications
You must be signed in to change notification settings - Fork 41
[DON-2163] Add explicit import for SPM support and avoid @_exported attribute #2400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[DON-2163] Add explicit import for SPM support and avoid @_exported attribute #2400
Conversation
…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.
There was a problem hiding this 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
@_exportedattributes from central import files (BackpackUIKitImports.swift, BackpackSwiftUIImports.swift, BackpackCommonImports.swift) - Added conditional
#if SWIFT_PACKAGEimports 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. | ||
| */ | ||
|
|
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
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.
| #if SWIFT_PACKAGE | |
| import BackpackTokens | |
| #endif |
| */ | ||
|
|
||
| // swiftlint:disable indentation_width | ||
| import UIKit |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
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.
| import UIKit |
Cleaned up unnecessary import statements in generated color and icon files to reduce clutter and improve code clarity.
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.