====
NSData interconversion
platform :ios, '8.0'
use_frameworks!
target 'YOUR_PROJECT_NAME' do
pod "PEAR-DataConvertor-Swift"
end
import PEAR_DataConvertor_Swift
let strData:NSData = DataConvertor.dataFromString("sample message")
print(strData)
let dataStr:String = DataConvertor.stringFromData(strData)
print(dataStr)
let intData:NSData = DataConvertor.dataFromInt(1010);
print(intData)
let dataInt:Int = DataConvertor.intFromData(intData)
print(dataInt)
let doubleData:NSData = DataConvertor.dataFromDouble(99.9999)
print(doubleData)
let dataDouble:Double = DataConvertor.doubleFromData(doubleData)
print(dataDouble)
let arrayData:NSData = DataConvertor.dataFromArray([dataStr,dataInt,dataDouble])
print(arrayData)
let dataArray:Array = DataConvertor.arrayFromData(arrayData)
print(dataArray)
let dictData:NSData = DataConvertor.dataFromDictionary([
"str":dataStr,
"intData":dataInt,
"double":doubleData,
"arrayData":dataArray])
print(dictData)
let dataDict:Dictionary = DataConvertor.dictionaryFromData(dictData)
print(dataDict)
let pngData:NSData = DataConvertor.dataFromPNGImage(UIImage(named: "pngsample.png")!)
print(pngData)
let dataPng:UIImage = DataConvertor.imageFromData(pngData)
print(dataPng)
let jpgData:NSData = DataConvertor.dataFromJPGImage(UIImage(named: "jpgsample.jpg")!, quality: 1.0)
print(jpgData)
let dataJpg:UIImage = DataConvertor.imageFromData(jpgData)
print(dataJpg)