-
-
Notifications
You must be signed in to change notification settings - Fork 92
Update Package.swift #52
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
Conversation
WalkthroughThe PR updates Package.swift to Swift tools 5.9, adds macOS v14 to supported platforms, and simplifies the target declaration. It also changes bundle identifiers in the Xcode project for both the library and example targets. No source code or public API changes are introduced. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 4
🧹 Nitpick comments (1)
Package.swift (1)
9-11: Fix trailing comma in platforms to satisfy linterSwiftLint warns about a trailing comma in the platforms array. Remove the trailing comma after the last element.
Apply this diff:
- .iOS(.v14), - .macOS(.v14), + .iOS(.v14), + .macOS(.v14)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these settings in your CodeRabbit configuration.
📒 Files selected for processing (2)
Package.swift(2 hunks)VisualEffectView.xcodeproj/project.pbxproj(4 hunks)
🧰 Additional context used
🪛 GitHub Check: build
Package.swift
[warning] 10-10:
Trailing Comma Violation: Collection literals should not have trailing commas (trailing_comma)
🔇 Additional comments (2)
VisualEffectView.xcodeproj/project.pbxproj (1)
209-216: Xcode project compatibility lags behind Swift tools 5.9compatibilityVersion = "Xcode 12.0" and LastUpgradeCheck = 1200 suggest an older project format. With Package.swift moving to tools 5.9 (Xcode 15+), consider bumping project settings or documenting that SPM requires Xcode 15 while the Xcode project remains older.
Would you like me to propose a minimal pbxproj upgrade diff (e.g., LastUpgradeCheck) and a README note about the minimum Xcode versions?
Package.swift (1)
1-1: Swift tools 5.9 requires Xcode 15+Bumping the tools version effectively raises the minimum Xcode for SPM consumers. Confirm this is intentional and update README/Release notes accordingly.
Would you like me to add a short “Requirements” note to the README indicating Xcode 15 / Swift 5.9 minimum for SPM users?
| .iOS(.v14), | ||
| .macOS(.v14), | ||
| ], |
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.
💡 Verification agent
🧩 Analysis chain
Adding macOS support: verify cross-platform compilation
With .macOS(.v14) added, ensure sources compile on macOS. If files import UIKit, gate code with #if canImport(UIKit) or provide AppKit counterparts (e.g., NSVisualEffectView).
Run this script to find UIKit imports and check for conditional guards:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Scanning for UIKit imports (may be iOS-only):"
rg -n --glob '!**/DerivedData/**' $'^\\s*import\\s+UIKit\\b' -A 2 -B 2 || true
echo
echo "Scanning for AppKit imports or NSVisualEffectView usage:"
rg -n --glob '!**/DerivedData/**' $'\\b(AppKit|NSVisualEffectView)\\b' -A 2 -B 2 || true
echo
echo "Scanning for platform conditionals:"
rg -n --glob '!**/DerivedData/**' $'^\\s*#if\\s+canImport\\((UIKit|AppKit)\\)' -A 2 -B 0 || true
echo
echo "If UIKit files are not conditionally compiled or AppKit equivalents are missing, macOS builds via SPM may fail."Length of output: 1890
Action required — macOS target added but UIKit-only sources found
Package.swift (lines 9–11):
.iOS(.v14),
.macOS(.v14),
],
Short summary:
Scan shows direct import UIKit in library/example sources and no AppKit imports or #if canImport(...) guards — macOS builds via SPM will likely fail.
Files to address:
- Sources/VisualEffectView.swift:9 —
import UIKit - Sources/UIViewEffectView+Helpers.swift:8 —
import UIKit - Example/ViewController.swift:9 —
import UIKit - Example/Extensions.swift:9 —
import UIKit - Example/AppDelegate.swift:9 —
import UIKit
Suggested fixes (pick one or combine):
- Wrap iOS-only code/imports with conditional compilation:
- #if canImport(UIKit)
import UIKit
// iOS-only code
#endif
- #if canImport(UIKit)
- Add AppKit equivalents/adapters (e.g., map UIVisualEffectView → NSVisualEffectView or provide small platform adapter/typealiases).
- Or move iOS-only files into an iOS-only target (or exclude them from the macOS target) in Package.swift.
Please address these so the package actually compiles on macOS.
🧰 Tools
🪛 GitHub Check: build
[warning] 10-10:
Trailing Comma Violation: Collection literals should not have trailing commas (trailing_comma)
🤖 Prompt for AI Agents
In Package.swift around lines 9–11 and the listed source files, you added a
macOS target but several files import UIKit directly which will break macOS
builds; fix by either (A) wrapping UIKit-only imports and the iOS-only code
blocks in those files with conditional compilation (#if canImport(UIKit) ...
#endif) so macOS builds skip them, or (B) provide macOS equivalents/adapters
(typealiases and small mapping for UIVisualEffectView → NSVisualEffectView and
any UIKit APIs used) and guard where platform-specific implementations differ,
or (C) remove/exclude those files from the macOS target (or remove macOS
platform) in Package.swift; pick one approach and apply it consistently to
Sources/VisualEffectView.swift, Sources/UIViewEffectView+Helpers.swift,
Example/ViewController.swift, Example/Extensions.swift, and
Example/AppDelegate.swift so macOS SPM builds no longer import UIKit unguarded.
| .target(name: "VisualEffectView") | ||
| ] |
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.
💡 Verification agent
🧩 Analysis chain
Target path removal likely breaks SPM source discovery
The target declaration dropped path: "Sources". Unless the repository layout is Sources/VisualEffectView/..., SPM will not find sources by default. If your files live directly under Sources (as the Xcode project suggests), keep the explicit path.
Apply this diff to restore the explicit path:
- .target(name: "VisualEffectView")
+ .target(
+ name: "VisualEffectView",
+ path: "Sources"
+ )Run this script to verify the layout matches SPM expectations:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Checking for default SPM layout (Sources/VisualEffectView)..."
if [ -d "Sources/VisualEffectView" ]; then
echo "OK: Found Sources/VisualEffectView (path override not required)."
else
echo "WARN: Sources/VisualEffectView not found."
echo "Listing Swift files directly under Sources (if any):"
fd -e swift --max-depth 1 Sources || true
echo
echo "If Swift files are directly under Sources/, keep path: \"Sources\" in Package.swift."
fiLength of output: 617
Restore explicit SPM path for VisualEffectView target (Package.swift)
Verification output: WARN: Sources/VisualEffectView not found. Without an explicit path SPM will not discover the target's sources — either add the path or move sources into Sources/VisualEffectView.
- File: Package.swift — lines 25-26: update the target declaration
Apply this diff:
- .target(name: "VisualEffectView")
+ .target(
+ name: "VisualEffectView",
+ path: "Sources"
+ )📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .target(name: "VisualEffectView") | |
| ] | |
| .target( | |
| name: "VisualEffectView", | |
| path: "Sources" | |
| ) | |
| ] |
🤖 Prompt for AI Agents
In Package.swift around lines 25-26, the VisualEffectView target is declared
without an explicit path so SPM warns "Sources/VisualEffectView not found";
update the target declaration to include the explicit path to the sources (e.g.
.target(name: "VisualEffectView", path: "Sources/VisualEffectView")) or
alternatively move the source files into Sources/VisualEffectView so SPM can
discover them.
| ); | ||
| MARKETING_VERSION = 4.1.5; | ||
| PRODUCT_BUNDLE_IDENTIFIER = com.efremidze.VisualEffectView; | ||
| PRODUCT_BUNDLE_IDENTIFIER = com.example.VisualEffectView; |
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.
🛠️ Refactor suggestion
Avoid placeholder bundle identifiers for the framework target
Using com.example.* is a placeholder and can cause code signing/provisioning conflicts for consumers and CI. Prefer a unique reverse-DNS identifier (e.g., previous com.efremidze.*) or at least a non-placeholder domain.
Apply this diff to use a unique bundle identifier:
- PRODUCT_BUNDLE_IDENTIFIER = com.example.VisualEffectView;
+ PRODUCT_BUNDLE_IDENTIFIER = com.efremidze.VisualEffectView;Apply at both the Debug and Release configurations (Lines 442 and 467).
Also applies to: 467-467
🤖 Prompt for AI Agents
In VisualEffectView.xcodeproj/project.pbxproj around lines 442 and 467, the
framework target uses the placeholder PRODUCT_BUNDLE_IDENTIFIER =
com.example.VisualEffectView; — replace that placeholder with a unique
reverse‑DNS identifier (for example com.efremidze.VisualEffectView) in both the
Debug (line 442) and Release (line 467) build configurations; search the file
for any other occurrences of com.example.VisualEffectView and update them
consistently, then save the project file so code signing/provisioning will use
the non‑placeholder bundle identifier.
| PRODUCT_BUNDLE_IDENTIFIER = com.example; | ||
| PRODUCT_NAME = "$(TARGET_NAME)"; |
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.
🛠️ Refactor suggestion
Use a unique bundle identifier for the Example app
Setting the Example app to com.example can conflict with other sample apps and makes device installs brittle. Include a unique suffix (or revert to the original).
Apply this diff to disambiguate the Example app’s bundle ID:
- PRODUCT_BUNDLE_IDENTIFIER = com.example;
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.Example;Apply for both Debug (Line 484) and Release (Line 500).
Also applies to: 500-501
🤖 Prompt for AI Agents
In VisualEffectView.xcodeproj/project.pbxproj around lines 484-485 and 500-501,
the PRODUCT_BUNDLE_IDENTIFIER is set to the generic "com.example"; replace both
occurrences with a unique bundle identifier (for example
com.yourcompany.VisualEffectView or com.example.VisualEffectViewExample) for
Debug and Release, update any corresponding Info.plist entries if present to
match the new identifier, and verify the project builds and installs to a
device.
Summary by CodeRabbit
New Features
Chores