Instaling without cocoapods - ios

https://github.com/IBM-Swift/Swift-SMTP
Im sorry if this is a dumb question but I am trying to install this inside my app and there is no documentation on how to add it. I always use cocoapods but it seems this can't be used for this project. Could anyone help me I need this functionality

That particular project/repo uses Swift Package Manager, so in Terminal cd into the project root:
$ swift package generate-xcodeproj
This will create an .xcodeproject which you'll then open and build. Once you've done that just drag the built framework into the project you'd like to include it in and use the import:
import SwiftSMTP

Related

Do I still need CocoaPod installation?

I am new to XCode and Swift. Trying to create a simple project that uses MQTT protocol. For that, there is a Swift library CocoaMQTT and there are directions on how to integrate it in an XCode project:
Installation
To integrate CocoaMQTT into your Xcode project using CocoaPods,
you need to modify you Podfile like the followings:
use_frameworks!
target 'Example' do
pod 'CocoaMQTT' end
Then, run the following command:
$ pod install
At last, import "CocoaMQTT" to your project:
import CocoaMQTT
The directives above are not straight forward to me as for a newbie, and I followed another way by importing the CocoaMQTT package through the XCode main menu: File -> Add Packages. Once the package was downloaded, I saw that the package (and the other dependencies) were automatically added to my project in the file navigator:
Question: do I still need to do CocoaPad installation as described above, or importing the package as I did is the new and sufficient way to integrate the library into the project? The Podfile that is mentioned in the instructions cannot be modified in XCode.
[Swift package] is the new and sufficient way
Correct. The library is now installed in your project and there is no further work to do.
In general, Swift packages supersede Cocoapods. Wherever possible, if a library offers a Swift package installation, you'll probably want to use that rather than Cocoapods.
In this particular case, you should file an issue on the documentation. They have added Swift Package as an alternative way of installing this library but they have forgotten to add that information to the instructions in the Readme.

How to import Carthage framework directly to the project in iOS?

I want to use Carthage dependency manager in my project. Due to security reason I'm not able to install the library through brew/package. Instead I got the Carthage library and it's having two files CarthageKit.framework and carthage exec files.
I've added the framework in the project and given the path in Framework Search path but it's not working. Don't know how to proceed it further. Can you please help me out.
Thanks in Advance!

How to get `react-native link` to link my library via Cocoapods?

I am writing a new library for React Native that uses native components for iOS and Android. It depends on another native library via Cocoapods, and contains a .podspec file. When I try to link it to a test project using react-native link, it successfully adds the source project as a library, but doesn't install the dependency via Cocoapods.
It looks like there are ways to customize the link behavior via rnpm keys in the package.json file, but I can't find any info on what those should be (it's also unclear if those are used by the newer link command, or are a holdover from the actual rnpm days.) If there are docs on that that you know of, please pass them along!
Otherwise, my main question is this: how can I get react-native link to install my dependency via Cocoapods, or do I need to reinvent that wheel?
Thanks in advance!

Build Swift 3 in Terminal to create XCode project

It seems Apple changed this line:
swift build -X
This no longer works to create an Xcode project as described here
Doest anyone know the updated way to do this as I cannot find it online
Thanks
Now you should use the Swift Package Manager.
To create a project structure:
swift package init --type executable
or
swift package init --type library
To make a project compatible with Xcode:
swift package generate-xcodeproj

No such module "PackageDescription"

I just started with swift 3 and made a simple app in xcode using Swift 3.0 . Now i want to add a third party library using Swift Package Manager . I am following installation method given in this link . I created Package.swift file which looks like this
import PackageDescription
let package = Package (
name : "SwiftPM",
dependencies : [
.Package(url: "https://github.com/ArtSabintsev/Siren.git", majorVersion: 1)
])
but i get error No such module "PackageDescription"
The Swift Package Manager and Xcode are orthogonal. That is, you can't expect to compile Package.swift in Xcode; it simply won't work. Instead, until Xcode supports the package manager, you need to have two distinct builds - one with the package manager and one with Xcode.
So, using the Swift Package Manager, once you've defined Package.swift and formulated your directory structure as expected by the package manger, you perform simply:
swift build
Then for Xcode, you create an Xcode project that uses your source code, but not Package.swift. You'll need to clone the Siren.git project, explicitly - into your Xcode build's source files.
Swift 3/4
Navigate to your project folder through a terminal and run these commands swift package init --type library first and then swift package generate-xcodeproj
Reference
For me the issue turned out to be Target Membership. I created the Package.swift file manually inside an iOS app project.
Solution:
Select and go to the Package.swift file
Open the File Inspector on the right side
Deselect any modules inside Target Membership section
Refer to the solution in this link:
https://forums.kodeco.com/t/server-error-no-such-module-packagedescription/177438
Command:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
For other people who faced the same error as this:
Fix your Package.swift syntax
I got this error because Xcode hadn't parsed Package.swift fully yet, because of syntax errors.
In my case, I had a .target(name: "name-of-target", dependencies: [""]). As soon as I removed the empty dependency string (""), Xcode immediately parsed the file, and the error disappeared. Remember to save the file though.
Also, GoZoner and Pratiks answers are outdated:
Xcode has integration with Swift Packages now (as shown above)
swift package generate-xcodeproj is deprecated, shown by the error message when using it:
warning: Xcode can open and build Swift Packages directly. 'generate-xcodeproj' is no longer needed and will be deprecated soon.
More information about what that is, and why its gone here.

Resources