Swift cocoapods

Example

This entry is an exmaple to use cocoapods with Swift.
Target library is LLSimpleCamera

Install cocoapods

I have already written this topic in cocoapods. This posts has how to install and how to setup

Prepare your project

Create swift application and go to your project root.

pod init
open -a Xcode Podfile

And open Podfile to edit.

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
# Uncomment this line if you're using Swift
use_frameworks!

target 'CameraSample' do

pod 'LLSimpleCamera', '~>4.1'

end

Podfile has pod
Next install dependencies.

pod install

LLSimpleCamera is installed.
And yourproject.xcworkspace was created.
Next time you want to open project, please open xcworkspace, not xcodeproj.
xcworkspace has all setting for Pods dependencies.

Prepare bridgeheader

To use Objective-C library from Swift, we need bridge header.
Create yourproject-Bridging-Header.h in any place

#ifndef CameraSample_Bridging_HEADER_h
#define CameraSample_Bridging_HEADER_h

#import <LLSimpleCamera.h>

#endif

And you need to set this as bridge header
This is an example
Bridge-Header

Add header search path

In my case, when build project, it failed.
Because cannot read LLSimpleCamera.h is not found.
I checked header path and I added search path for pods.(Header Search Path)
Header Search Path

Import

import LLSimpleCamera