Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// swift-tools-version:5.3
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "VisualEffectView",
platforms: [
.iOS(.v14)
.iOS(.v14),
.macOS(.v14),
],
Comment on lines +9 to 11

Copy link
Copy Markdown

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
  • 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.

products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
Expand All @@ -21,10 +22,6 @@ let package = Package(
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "VisualEffectView",
dependencies: [],
path: "Sources"
)
.target(name: "VisualEffectView")
]
Comment on lines +25 to 26

Copy link
Copy Markdown

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."
fi

Length 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.

Suggested change
.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.

)
8 changes: 4 additions & 4 deletions VisualEffectView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@
"@loader_path/Frameworks",
);
MARKETING_VERSION = 4.1.5;
PRODUCT_BUNDLE_IDENTIFIER = com.efremidze.VisualEffectView;
PRODUCT_BUNDLE_IDENTIFIER = com.example.VisualEffectView;

Copy link
Copy Markdown

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_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -464,7 +464,7 @@
"@loader_path/Frameworks",
);
MARKETING_VERSION = 4.1.5;
PRODUCT_BUNDLE_IDENTIFIER = com.efremidze.VisualEffectView;
PRODUCT_BUNDLE_IDENTIFIER = com.example.VisualEffectView;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
Expand All @@ -481,7 +481,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.efremidze.Example;
PRODUCT_BUNDLE_IDENTIFIER = com.example;
PRODUCT_NAME = "$(TARGET_NAME)";
Comment on lines +484 to 485

Copy link
Copy Markdown

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.

};
name = Debug;
Expand All @@ -497,7 +497,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.efremidze.Example;
PRODUCT_BUNDLE_IDENTIFIER = com.example;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand Down