I've developed a simple Swift Package
with a UIView
to use it in more projects.
I needed in that UIView
to use a UIImageView
that receives the image from a URL
and I want for that to use SDWebImage
.
I've added in my Swift Package Package.swift
the SDWebImage
as dependency and it created a Package.resolved
in root directory and also added a Package dependency
to SDWebImage
:
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MyPacket",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(name: "MyPacket", targets: ["MyPacket"])
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(name: "SDWebImage", url: "https://github.com/SDWebImage/SDWebImage.git", .upToNextMajor(from: "5.0.0"))
],
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 this package depends on.
.target(
name: "MyPacket",
dependencies: [
.product(name: "SDWebImage", package: "SDWebImage")]
)
]
)
Everything works well until this point.
In my main project
I also have SDWebImage
as a pod
installed and now in main project
beside MyPacket
in Package Dependencies
it also shows SDWebImage
as a dependency which means that SDWebImage
is both in Podfile
and Package Dependencies
.
The application works but it throws this warning for every SDWebImage method
:
objc[72670]: Class SDWeakProxy is implemented in both /Users/user/Library/Developer/CoreSimulator/Devices/81EA832E-6ED3-4560-8994-298CB8A00D2A/data/Containers/Bundle/Application/B01EFC62-3996-473D-9F8C-6FCCF80BF077/MyMaiProject.app/Frameworks/SDWebImage.framework/SDWebImage (0x10c5cd370)
and /Users/use/Library/Developer/CoreSimulator/Devices/81EA832E-6ED3-4560-8994-298CB8A00D2A/data/Containers/Bundle/Application/B01EFC62-3996-473D-9F8C-6FCCF80BF077/MyMainProject.app/MyMainProject (0x10139aaa0). One of the two will be used. Which one is undefined.
Question
Is there any way to condition the Podfile
if the framework
is already in Package Manager
to not initialise it or to remove the SDWebImage
from the MainProject Package Dependencies
?
Or is posibile to use the SDWebImage
, that is installed in my MainProject
with pods, in my Packet
that is installed with Package Manager
?