My problem is that I have developed a framework committed and pushed through Git server no problem, now I want to add a third party library like Alamofire to the framework, in order to generate a framework file that I can send or use anywhere.
So far my options are:
Cocoapods, but couldn't commit and push added cocoa pods and workspace.
Carthage, didn't know about it much
Swift package manager; played with it a bit, but couldn't push the package and other new .xcodeproject files.
any other failed ways like adding needed files only, or adding the product framework file from Alamofire to My Framework project which is useless.
So I still need help with adding 3rd party framework to My framework, push it correctly and completely to git server, so that I can clone it or download it from another mac.
Please help.
I suggest you to add Alamofire with Carthage, doing so:
install Carthage:
$ brew update
$ brew install carthage
at the root of your project, create the file Cartfile and add the following line:
github "Alamofire/Alamofire" ~> 4.5
run carthage update
drag and drop Alamofire.framework inside your project and that's it.
about Alamofire+Carthage, you can check the official documentation here: https://github.com/Alamofire/Alamofire#carthage
regarding how to integrate a framework with Carthage, check here:
https://github.com/Carthage/Carthage#adding-frameworks-to-an-application
Related
I am using buddybuild to build our app & I'm not sure how I'm supposed to use the react-native-fbsdk? The docs tell us to put the Library in ~/Documents/FacebookSDK. But for build tools such as Buddybuild (travis, circle, etc...), I'm not sure what we're supposed todo here?
Our app does not use cocoapods, it uses carthage.
Any ideas?
So far the only option would be to install cocoapods & install the dependency from there?
Update:
I found that Carthage supports the swift SDK: https://developers.facebook.com/docs/swift/login
However I don't think the react-native-fbsdk package works with the swift implementation
Related:
https://developers.facebook.com/bugs/110631459337469/
https://github.com/Carthage/Carthage/issues/1183
For those who are not using CocoaPods for any reason, here´s how replicate https://stackoverflow.com/a/45642866/165622 main idea into AppCenter:
First of all, you need to copy the Facebook Sdk files somewhere into your project. In my case I´d put them at {PROJECT}/ios/Facebook
Then you need to create a appcenter-post-clone.sh file at the root of your react-native project (as described here: https://learn.microsoft.com/en-us/appcenter/build/custom/scripts/) making sure to add:
ln -s $APPCENTER_SOURCE_DIRECTORY/ios/Facebook $HOME/Documents/FacebookSDK
Note that the Documents folder already exists there, so need to create it.
Yes, this is an issue which is currently waiting for the patch here bug report, meanwhile, a solution for buddybuild could by creating a symbolic link for the hard-coded path.
For more information regarding post-clone see postclone docs
# File: buddybuild_postclone.sh
# Creating virtual symbolic link for FB SDK for buddybuild
mkdir ~/Documents
ln -s $BUDDYBUILD_WORKSPACE/ios/libs/FacebookSDK ~/Documents/FacebookSDK
I'm trying to install Swifter framework to Xcode that provided by github here:
https://github.com/mattdonnelly/Swifter
but the installation is not clear enough, there is no folder had the extenssion .framework with header folder inside it
can someone please help me how to get this framework to my project
thank you
IF you are using Cocoapods, add the following line to your Podfile.
pod 'Swifter', :git => 'https://github.com/mattdonnelly/Swifter.git'
Run pod install then you should be set.
First of all you should clone the repo. After that drag and drop Swifter.xcodeproj to your project. Lastly add SwifteriOS.framework to linked frameworks and libraries of your project.
I have read about a possibility to add CocoaPods to an XcodeProject without getting the xcworkspace file, instead you get a xcodeproj file that you can integrate into your current project. How can I do that? Would love to use the xcodeproj file instead of xcworkspace.. I'm programming in swift (if that makes any difference).
Yes, its possible. But, we need to do few steps to proceed.
Check this Github thread.
The below line in pod.file will not let the client integration process.
install! 'cocoapods', :integrate_targets => false
We can drag and drop the Pods.xcodeproj to the main project
Link the target dependencies and Link Binary with Libraries in Build phases.
Thats it.
You can not do this.
The CocoaPods website guide to using CocoaPods found here directs you to using the .xcworkspace it creates. Several other guides found across the Internet all direct you to use this file indicating that using the .xcodeproj file will now result in build errors.
There is simply no evidence that this is a possibility at all.
From the CocoaPods website guide on using CocoaPods:
Save your Podfile.
Run $ pod install
Open the MyApp.xcworkspace that was created. This should be the file you use everyday to create your app.
More from their website:
Now you can install the dependencies in your project:
$ pod install
Make sure to always open the Xcode workspace instead of the project
file when building your project:
$ open App.xcworkspace
And from the Ray Wenderlich guide regarding using CocoaPods with Swift:
Open the project folder using Finder, and you’ll see that CocoaPods
created a new IceCreamShop.xcworkspace file and a Pods folder in which
to store all the project’s dependencies.
And from an NSHipster article on CocoaPods:
CocoaPods will create a new Xcode project that creates static library
targets for each dependency, and then links them all together into a
libPods.a target. This static library becomes a dependency for your
original application target. An xcworkspace file is created, and
should be used from that point onward. This allows the original
xcodeproj file to remain unchanged.
In older versions of cocoapods it was possible to install and update pods with the option '--no-integrate'. It allows you to create a library project, which could be imported into an existing project (read more). But this option is missing now. I've build a Xcode project for a maven-build with this option earlier. Today I've updated the pods of this project with the newest cocoapods version (1.0.0) but without the '--no-integrate' option and it still works. So eventually there is a way...
I am using the new open source Swift Package Manager and am able to download the files.
I want the manager to create a "development environment" (Through Xcode) based on the packages it retrieved.
Has anybody dealt with this?
Update: as mentioned in other answers, you can now generate Xcode project files with this command:
swift package generate-xcodeproj
Original answer:
The Swift Package Manger (SPM) is cross platform, It works on Mac and Linux.
The Xcode is Mac OS only, so I don't think SPM will be hard integrate to work with Xcode.
SPM can do 2 things:
Build swift source code into modules (Executable and Library)
Fetch dependencies (from git or local path)
The SPM work only with Source code, folders and files. It doesn't know anything about Xcode.
Also it is mentioned that in the future Apple plans to add support for other languages not only Swift and Objc.
My answer: SPM will not ingrate with Xcode. But because it's open-source anyone can just make its own fork and add custom feature that would generate Xcode specific files.
Update (2021/05/23):
With Xcode having gained official support for Swift Packages the recommended way to create packages these days is from within Xcode via "Xcode > File > New > Swift Package".
Update (2020/11/20):
With PR 3062 merged generate-xcodeproj will soon be marked as deprecated.
Original answer:
As of PR #174 on the swift-package-manager project, there exists an option for generating an Xcode project file in root directory of the package:
$ swift package generate-xcodeproj
Note: Earlier builds used:
$ swift build --generate-xcodeproj
It will officially be part of Swift's 3.0 release.
But it is already available with Xcode Swift DEVELOPMENT Snapshot 2016-03-24 or later!
All you need to do now, if you had Xcode 11 installed is just run this command and xcode-tools will automatically open the appropriate Package.swift and resolve as an project for you to open in Xcode:
$ xed .
Pre 2020:
I wrote a small command line tool for that
it's called spawn: https://github.com/vinhnx/spawn
Basically, it's just a small combination of repetitive commands when you want to try out a SPM package:
$ swift package update # update or resolve package dependencies
$ swift package generate-xcodeproj # generate a .xcodeproj to edit on Xcode
$ xed . # open generated .xcodeproj automatically
I have started using CocoaPods in an Xcode project that I am sharing with a non-technical team via SVN.
Before I commit the contents of my project folder, I wanted to ask whether they would also need CocoaPods installed in order to build and run the project?
Hopefully not?
If you do not add the Pods folder to your SVN repo then they will obviously have to have CocoaPods to build the project. Since otherwise none of your third party libraries will be included.
If you do add the Pods folder then the project will work just fine without CocoaPods installed.