How to a dependency to my custom cocoapod? - swift

I'm creating a cocoapods which is doing some crypto stuff. I've a dependency in my podspec file (mean another cocoapods library).
My spec file is:
...
s.dependency 'BigInt', '~> 1.3.0'
end
And it can pass pod verification successfully but I cannot see this library in my class, I cannot import! How I can import this library without any error?

Actually I got the idea! While working on your cocoapod you need to create another test project with your cocoapod's dependencies. So you won't see any error.
Also when you add your cocoapods to a project, It'll download automatically its dependency and add them to pods project's frameworks.

Related

Bundle all local transient Swift Packages into a single xcframework

I am developing a SDK and use SPM to modularise my code. All code is written in Swift.
My project structure is like this:
SampleApp (Workspace) -> SDK (SPM) -> ModuleA (SPM)
I can build and run the sample app locally successfully.
Now I want to archive/build the SDK package into a dynamic xcframework that my other clients can just drag and drop into their Xcode to consume.
I'm using xcodebuild -create-xcframework for that purpose and can successfully build a sdk.xcframework file.
But in a separated sample app where I embed the sdk.xcframework there, when import SDK module, I get this error
No such module 'ModuleA'
Failed to build module 'SDK' for importation due to the errors above; the textual interface may be broken by project issues or a compiler bug
I assume here, this is because the compiler can't find ModuleA
Is there anyway that I can bundle the ModuleA into sdk.xcframework statically, so that my clients can just drag only sdk.xcframework into their projects to consume the SDK module?
The question is pretty much: How can I bundle ModuleA and SDK into a single .xcframework for distribution

Podspec dependency installation

I want to add SwiftLint to my framework. In my framework's .podspec file, I have added:
s.dependency `SwiftLint`
What is the next step to see the dependency at work? Is there some sort of command I need to run in the command line to "install" the dependency?
In the project that uses your framework, do pod update or just pod update MyFramework .

Cocoapods SwiftWebSocket in Xcode project - library is not found

I'm experimenting with SwiftWebSocket in Swift using Xcode 10.1.
I've added the pod via this podfile:
platform :osx, '10.14'
target 'ViewWebSocketLearning' do
use_frameworks!
pod 'SwiftWebSocket', '~> 2.7'
end
and I've loaded the pod as follows:
$ pod install
Analyzing dependencies
Downloading dependencies
Using SwiftWebSocket (2.7.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
which produces a workspace with the SwiftWebSocket project included in it. I compiled the projects and you can see that it is correctly compiling both my empty project and the SwiftWebSocket project properly. Everything is looking good so far.
However as soon as I try to include a reference to the SwiftWebSocket project in my project's unit tests, Xcode chokes. Here's a snip of my code:
import SwiftWebSocket
...
let ws = WebSocket("wss://echo.websocket.org")
I get "No such module 'SwiftWebSocket'". If I take out the import, I get "Use of unresolved identifier 'WebSocket'". So something isn't linking properly by the looks of it.
I've tried adding the compiled framework from the SwiftWebSocket project to mine in the project organizer on the left, no change. I've added it to the Linked Frameworks and Libraries in the target settings, again no change.
What am I missing?
I'm a relative novice to Xcode so apologies but I really would like to get past this point so your help is much appreciated! Thank you.
It's not exactly the solution I was shooting for, but I solved this by building a class in my project which contains the logic to control the SwiftWebSocket, then called that class from inside the unit tests.
Architecturally this is probably cleaner but I remain unclear on why I couldn't access the SwitfWebSocket directly from the unit tests.

Compiling greenDAO source

When I do a fresh git clone of the greenDAO repo, import the project with Android Studio, and try to compile, references to all the Android objects throw Unresolved Symbol/Method errors. Similarly, the Android specific import statements are also unresolved.
I've gotten as far as realizing that the build.gradle files don't call apply plugin: 'android', but instead lists dependencies like:
dependencies {
provided 'com.google.android:android:4.1.1.4'
provided 'com.google.android:android-test:4.1.1.4'
provided 'com.google.android:annotations:4.1.1.4'
provided 'com.google.android:support-v4:r7'
provided 'com.google.android:support-v4:r7'
...
}
I've used the SDK manager to make sure I have all the files for API v4.1 installed. I also know how to use greenDAO by using the Maven repos and/or importing JARs. My problem is specific to building from source.
Update 1: As stated, when using provided, none of the Android files are found.
I don't have enough reputation to post images, but you can find a screenshot here.

Using region digraph bundle of equinox project

I'm trying to use region digraph bundle of equinox in my project. As first step, I'm trying to test the bundle org.eclipse.equinox.region using org.eclipse.equinox.region.tests bundle exists in equinox project.
When I import the relevant bundles to Eclipse IDE, I get error in loading org.eclipse.core.tests.harness.PerformanceTestRunner package in RegionPerformanceTests class. This caused because I couldn't import the above package in the manifest file. When I try to add it as dependency in manifest file, This package is not there to be added. I couldn't find any packages given in this link when I add dependencies given in this link
It will be really helpful if I can get some help regarding this issue.