Saturday, 18 November 2017

Homebrew and Carthage Intallation




Homebrew and Carthage Intallation 


To install Carthage and create Cartfile, Follow below step - 

A. Install Homebrew

Website :  https://brew.sh
  1. Open terminal
  2. Paste below code and enter - Command  :  /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  3. Enter, wait for while

B. Install Carthage
  1. Download the latest “Carthage.pkg” from this website : https://github.com/Carthage/Carthage/releases, ( In my case - 0.26.2 )
  2. Double-click Carthage.pkg to run the installer
  3. Click Continue, select a location to install to, click Continue again, and finally click Install

Note : When you attempt to run the installer, you may see a message stating “Carthage.pkg can’t be opened because it is from an unidentified developer.” If so, Control-click the installer and choose Open from the context menu.

C. Check Carthage Version
  1. Open Terminal & Hit this command - carthage version

D. Creating First Cartfile

A Cartfile is a simple text file that describes your project’s dependencies to Carthage, so it can determine what to install. Each line in a Cartfile states where to fetch a dependency from, the name of the dependency, and optionally, which version of the dependency to use. A Cartfile is the equivalent of a CocoaPods Podfile.
Navigate to the root directory of your project in Terminal (the directory that contains your .xcodeproj file) using the cd command:

cd ~/Path/To/Starter/Project

Create an empty Cartfile with the touch command:

touch Cartfile

And then open the file up in Xcode for editing:

open -a Xcode Cartfile

If you’re familiar with another text editor, like Vim, then feel free to use that instead. Don’t, however, use TextEdit to edit the file; with TextEdit it’s too easy to accidentally use so-called “smart quotes” instead of straight quotes, and they will confuse Carthage.
Add the following lines to the Cartfile and save it:
github "Alamofire/Alamofire" == 4.5
github "Alamofire/AlamofireImage" ~> 3.2
These two lines tell Carthage that your project requires Alamofire version 4.5, and the latest version of AlamofireImage that’s compatible with version 3.2.





/////
 FOR SOCKET
Carthage
Add this line to your Cartfile:
github "socketio/socket.io-client-swift" ~> 13.0.0
Run carthage update --platform ios,macosx.
Add the Starscream and SocketIO frameworks to your projects and follow the usual Carthage process.
CocoaPods 1.0.0 or later
Create Podfile and add pod 'Socket.IO-Client-Swift':
use_frameworks!

target 'YourApp' do
    pod 'Socket.IO-Client-Swift', '~> 13.0.0'
end
Install pods:
$ pod install
Import the module:
Swift:
import SocketIO
Objective-C:
@import SocketIO;


Summary

1. Copy path pf your project

cd ~/Path/To/Starter/Project

2. Create an empty Cartfile with the touch command:

touch Cartfile

3. And then open the file up in Xcode for editing:

open -a Xcode Cartfile

4. Add the following lines to the Cartfile and save it:


add cart file like - github "Alamofire/Alamofire" == 4.5

5. Now, Install Carthage

carthage update --platform ios,macosx


No comments:

Post a Comment