Steps to reproduce:
git clone AudioKit (master branch)
In xCode, open an example project. e.g Examples/iOS/SequencerDemo/SequencerDemo.xcodeproj
build (try to run, with a Simulator target)
I get a: No such module AudioKit in ViewController.Swift:9
Analysis:
In the SequencerDemo Target, under Linked Frameworks and Libraries I DO see the AudioKit.framework and it has the correct path.
Details:
I am using xCode 10.3 (on OSX Catalina, 10.15 Beta)
master branch commit: 3e6945ad6820f6103e95ca18ec6607ee64e5bed3
P.S: I am a Swift/xCode noob, so I might be missing something trivial here.
If you clone the repo, you still need to build the framework:
From the terminal in the directory you cloned AUdioKit:
cd Frameworks
./build_frameworks.sh
Check out the Frameworks README for more information.
Related
I have a project and:
the company I'm working with is self-hosting their git
the CI can communicate only with company's network
That being said, if I want to install any dependency, I have to ask their dev ops to mirror the target repository and only then I can use it.
The problem arises when I want to implement Crashlytics which has a lot of dependencies. When I import the Firebase, it's fetched from the mirrored repo correctly, but it's dependencies are still being fetched from the original URLs (which makes perfect sense).
The question is - How do I tell Swift Package Manager to swap each URL with mirrors? I have all the dependencies mirrored. I only need to tell SPM to use it.
I have found this proposal which was implemented in Swift 5, but when I go to root of my project and run:
$ swift package config set-mirror --package-url <original URL> --mirror-url <mirror URL>
I get this error:
error: root manifest not found
Any ideas how to do this correctly? Thank you
EDIT:
As Florian correctly pointed out, the proposal works from the package's repository, not my projects! So:
I do clone mirrored repo in my project's root
I run set of commands to set mirror url for each dependency:
swift package config set-mirror \
--original-url https://github.com/google/GoogleAppMeasurement.git \
--mirror-url <company's url>/mirrors/githubcom-google-GoogleAppMeasurement
I go back to projects root and run:
xcodebuild -resolvePackageDependencies -project MyProject.xcodeproj -scheme MyAppScheme
But it's still fetching from original urls, not the mirrors!
Having an Xcode project makes this task basically impossible (at the time of writing). Xcode's integration with SPM works fine for most things, but is not (yet?) at par with what SPM can do in pure SPM packages.
The problem is, that swift package config is always only local to the package and does not have any effect on projects / packages that depend on the package. And with Xcode currently having no counterpart to swift package config, it's not possible to do this at the moment.
What you could do, however, is to clone all your dependencies locally and then reference them as local packages from Xcode (simply dragging the package folder into the open Xcode project will do so). Xcode will be smart enough to take the dependencies from the local local checkout (or at least it was smart enough last time I tried this).
Let's hope for a future Xcode version with full SPM support!
How can we create iOS framework with CocoaPods, Carthage and Swift Package Manager support, and Travis for running tests and Fastlane for release automation?
I wrote a long series from scratch about "Creating iOS framework with CocoaPods, Carthage, SPM support and Travis for running test and Fastlane for release automation" on Medium. I hope it helps.
Creating Swift framework is easy but adding CocoaPods, Carthage and Swift Package Manager support at the same time can sounds like scary in the first place. In addition to that adding Travis to run test for all commits and adding Fastlane to automate release processes for all dependency managers looks like a horror movie. But don’t be afraid. After you finished this series, you can easily create your own Swift frameworks that uses all these tools to make it perfect!
Part 1 — Create CocoaPod and release it.: You will create your own CocoaPod and release it.
Part 2 — Add Carthage support: Your CocoaPod that is created and released at Part 1 will be installed via Carthage.
Part 3 — Add Swift Package Manager support: Your CocoaPod that is created and released at Part 1 will be installed via Swift Package Manager.
Part 4 — Integrate Travis to build example project and run tests for framework: Your framework that can be installed via CocoaPods, Carthage and Swift Package Manager runs tests automatically on Travis for every push on GitHub.
Part 5 — Integrate Fastlane to automate release processes by running just one line of command.:
Every time you want to release new version of your framework via CocoaPods, Carthage and Swift Package Manager, you have to go through following steps:
1- Implement changes for new version
2- Run tests to be sure they are working
3- Commit and push changes for new version.
4- Tag new version to git
git tag 0.1.1
git push origin 0.1.1
Carthage and Swift Package Manager installs your framework from GitHub. If you configure your framework correctly, it can be installed via Carthage or Swift Package Manager after this step. However, CocoaPods has 4 more steps to complete release processes.
5- Increment podspec version => i.e. s.version = '0.1.1'
6- Validate local podspec:
pod lib lint ODCustomFramework.podspec
7- Validate pod for release
pod spec lint ODCustomFramework.podspec
8- Release
pod trunk push ODCustomFramework.podspec
After Travis and Fastlane integration, steps 2, 4, 5, 6, 7 and 8 are automated and those steps are no longer needed to repeat every time you want to release new version.
1- Implement changes for new version
2- Commit and push changes for new version.
3- Travis runs tests automatically after every push.
4- Run following fastlane command to automate all release processes. (step 4, 5, 6, 7, 8)
exec fastlane major | minor | patch
I have created a swift (iOS/MacOS) library on CocoaPods (BillboardSwiftLibrary). Generally, it has its assets and Classes folders which contain the source files.
I want my library to support Swift Package Manager, so I moved the source files from the Classes folder into a Sources folder outside the pod. However, they are still accessible from the Development pods.
Now my library won't build for Cocoapods launch but compiles for Swift Package Manager, I get the error below when I run pod lib lint BillboardSwiftLibrary.podspec
ERROR | file patterns: The source_files pattern did not match any
file.
I wrote a long series from scratch about "Creating iOS framework with CocoaPods, Carthage, SPM support and Travis for running test and Fastlane for release automation" on Medium. I hope it helps.
Creating Swift framework is easy but adding CocoaPods, Carthage and Swift Package Manager support at the same time can sounds like scary in the first place. In addition to that adding Travis to run test for all commits and adding Fastlane to automate release processes for all dependency managers looks like a horror movie. But don’t be afraid. After you finished this series, you can easily create your own Swift frameworks that uses all these tools to make it perfect!
Part 1 — Create CocoaPod and release it.: You will create your own CocoaPod and release it.
Part 2 — Add Carthage support: Your CocoaPod that is created and released at Part 1 will be installed via Carthage.
Part 3 — Add Swift Package Manager support: Your CocoaPod that is created and released at Part 1 will be installed via Swift Package Manager.
Part 4 — Integrate Travis to build example project and run tests for framework: Your framework that can be installed via CocoaPods, Carthage and Swift Package Manager runs tests automatically on Travis for every push on GitHub.
Part 5 — Integrate Fastlane to automate release processes by running just one line of command.:
Every time you want to release new version of your framework via CocoaPods, Carthage and Swift Package Manager, you have to go through following steps:
1- Implement changes for new version
2- Run tests to be sure they are working
3- Commit and push changes for new version.
4- Tag new version to git
git tag 0.1.1
git push origin 0.1.1
Carthage and Swift Package Manager installs your framework from GitHub. If you configure your framework correctly, it can be installed via Carthage or Swift Package Manager after this step. However, CocoaPods has 4 more steps to complete release processes.
5- Increment podspec version => i.e. s.version = '0.1.1'
6- Validate local podspec:
pod lib lint ODCustomFramework.podspec
7- Validate pod for release
pod spec lint ODCustomFramework.podspec
8- Release
pod trunk push ODCustomFramework.podspec
After Travis and Fastlane integration, steps 2, 4, 5, 6, 7 and 8 are automated and those steps are no longer needed to repeat every time you want to release new version.
1- Implement changes for new version
2- Commit and push changes for new version.
3- Travis runs tests automatically after every push.
4- Run following fastlane command to automate all release processes. (step 4, 5, 6, 7, 8)
exec fastlane major | minor | patch
From #Larme's comment, I found the answer.
In your podspec file, change the location of your classes to the sources folder.
So changed my s.source_files from to BillboardSwiftLibrary/Classes/**/* to Sources/**/* and pod lib lint BillboardSwiftLibrary.podspec worked fine.
I'm trying to convert an open source project that I do not own to use Carthage so I can include it as a dependency. I added a new scheme and have made that scheme Shared. I checked it in to my local git repo of the source. This is in my Cartfile:
git "file:///Users/crystaltwix/Projects/plcrashreporter" "shared-scheme"
When I try to run
carthage update --platform iOS
I do see that Carthage checks out plcrashreporter with the correct git hash, but the error I get is
*** Skipped building plcrashreporter due to the error:
Dependency "plcrashreporter" has no shared framework schemes for any of the platforms: iOS
Is there something else that needs to be done in order to have a framework be available through Carthage?
I did integrate the plcrashreporter framework with Carthage, but since the project is quite obsolete, I had to fork a pull request which is this one:
https://github.com/plausiblelabs/plcrashreporter/pull/9
as you can see, there are many commits there (#34), some related specifically to Carthage, some others for cleanup and fixing the targets.
You can find the repo here:
https://github.com/feelform/plcrashreporter
My test (you may find it here) has the following:
Cartfile: github "feelform/plcrashreporter"
In build settings, Run Script:
/bin/sh: /usr/local/bin/carthage copy-frameworks
Input files: $(SRCROOT)/Carthage/Build/iOS/CrashReporter.framework
Output files:$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/CrashReporter.framework
I keep getting linker error when running my project on circleCI saying that realm framework is not found. I have no problem with the framework on my development environment. I have checked the framework search path to include both $(inherited) and carthage build folder ($(PROJECT_DIR)/Carthage/Build/iOS). Below are the content of both my cartfile and circle.yml (circleCI's configuration file)
cartfile
github "Alamofire/Alamofire" ~> 3.4
github "Alamofire/AlamofireImage" ~> 2.0
github "SwiftyJSON/SwiftyJSON" ~> 2.3.0
github "SnapKit/SnapKit" >= 0.15.0
github "realm/realm-cocoa"
circle.yml
machine:
xcode:
version: "7.3"
dependencies:
pre:
- curl -O https://gist.githubusercontent.com/cabeca/cbaacbeb6a1cc4683aa5/raw/8e17f39f5a7413fd0559c9e6808e01b6fb514422/simulator_populator
- ruby ./simulator_populator
- carthage update --platform iOS
The 2 lines before carthage update are suggested by circleCI support tech to avoid issues with tvOS framework. I have also tried switching carthage update to carthage bootstrap with the same result. Below are the error message I get
From the screenshot it seems like the error occurs when it tries to link test files, but both test and uitest files are default created by xcode, I haven't added anything on it yet
but both test and uitest files are default created by xcode, I haven't added anything on it yet
I think that's the problem here. You need to make sure that both targets can find the framework via the build setting FRAMEWORK_SEARCH_PATHS. This should include the parent directory of the relevant frameworks, e.g. $(SRCROOT)/Carthage/Build/iOS. You can achieve that usually by dragging or adding the framework(s) to the "Link Binary with Libraries" build phase.
You need
carthage bootstrap --platform iOS
not
carthage update --platform iOS