2

I'm using a library called ImagePicker from github to get images from the user and upload them. However when i implement the sample code, found here, i get the following error:

Type 'changeCoverViewController' does not conform to protocol 'ImagePickerDelegate'

on line one of the code:

class changeCoverViewController: UIViewController, ImagePickerDelegate {
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
user4174219
  • 427
  • 5
  • 13
  • cmd+click on `ImagePickerDelegate` you will be directed to library where its protocols have been declared, add those function's in this viewController – Dravidian Aug 22 '16 at 19:06
  • When i cmd+click on ImagePickerDelegate it says "Couldn't generate swift representation" "Error (from SourceKit): Could not load module: ImagePicker" @Dravidian – user4174219 Aug 23 '16 at 14:52
  • https://github.com/Carthage/Carthage/issues/921 – Dravidian Aug 24 '16 at 10:08

1 Answers1

5

You are probably missing one of the required ImagePickerDelegate functions. Specifically these:

func wrapperDidPress(imagePicker: ImagePickerController, images: [UIImage])
func doneButtonDidPress(imagePicker: ImagePickerController, images: [UIImage])
func cancelButtonDidPress(imagePicker: ImagePickerController)

In the future if you notice this error again go to the declaration of the delegate and you'll see a class protocol and that'll tell you what is required to implement said delegate. In this case:

public protocol ImagePickerDelegate: class {
  func wrapperDidPress(imagePicker: ImagePickerController, images: [UIImage])
  func doneButtonDidPress(imagePicker: ImagePickerController, images: [UIImage])
  func cancelButtonDidPress(imagePicker: ImagePickerController)
}
John Riselvato
  • 12,854
  • 5
  • 62
  • 89
  • I can't seem to find the declaration of the delegates, and when i cmd+click on ImagePickerDelegate it says "Couldn't generate swift representation" "Error (from SourceKit): Could not load module: ImagePicker" – user4174219 Aug 23 '16 at 16:12
  • Could this be due to using Carthage – user4174219 Aug 23 '16 at 16:12
  • Carthage is another question then. Might want to look at this answer @user4174219, http://stackoverflow.com/questions/32894901/xcode-couldnt-generate-swift-representation-for-my-own-framework – John Riselvato Aug 24 '16 at 00:39