This repository has been archived by the owner on Apr 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
1.3 iOS Integration (Swift)
pJes2 edited this page Apr 26, 2016
·
7 revisions
- Get an API Key
- Go to Filepicker.io to register an account.
- API Keys are typically randomized and 20 characters long.
- Add
FPPicker
to yourPodfile
platform :ios, '8.0'
use_frameworks!
target :'MyImagesApp' do
pod 'FPPicker', '~> 5.1.6'
end
- Run
pod install
- Setup
- Create new file
Bridge.h
and add to your project - In project settings set path to file
Bridge.h
in propertyObjective-C Bridging Header
- Add imports
#import "FPPicker.h"
and#import FPExternalHeaders.h
toBridge.h
- Add the following code on your app delegate and use the API Key you got after registering:
func initalize(){
FPConfig.sharedInstance().APIKey = "SET_FILEPICKER.IO_APIKEY_HERE";
}
-
In Use
- Make your controller conform to the FPPickerControllerDelegate (and optionally to the FPSaveControllerDelegate):
- Instantiate the objects and configure them
var picker:FPPickerController = FPPickerController(); picker.fpdelegate = self; (...) var saveController:FPSaveController = FPSaveController(); saveController.fpdelegate = self; (...)
- Implement the delegate methods
func fpPickerController(pickerController: FPPickerController!, didFinishPickingMediaWithInfo info: FPMediaInfo!) { // Handle accordingly } func fpPickerControllerDidCancel(pickerController: FPPickerController!) { // Handle accordingly } func fpSaveController(saveController: FPSaveController!, didFinishSavingMediaWithInfo info: FPMediaInfo!) { // Handle accordingly } func fpSaveControllerDidCancel(saveController: FPSaveController!) { // Handle accordingly } (...)