I imported a module from CocoaPods inside swift. i did everythings as it needs to be done and it also works, because the module is succesfully imported. i now want to test some demo script of BSimagepicker but it says undeclared type : PHAsset.
What i need to do is to select different images and load this into some sort of imagepicker preview inside the app.
Someone can help to fix this error?
@IBOutlet var imageView: UIImageView!
@IBOutlet weak var PicLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//startbsimpagepicker
let vc = BSImagePickerViewController()
bs_presentImagePickerController(vc, animated: true,
select: { (asset: PHAsset) -> Void in
// User selected an asset.
// Do something with it, start upload perhaps?
}, deselect: { (asset: PHAsset) -> Void in
// User deselected an assets.
// Do something, cancel upload?
}, cancel: { (assets: PHAsset) -> Void in
// User cancelled. And this where the assets currently selected.
}, finish: { (assets: [PHAsset]) -> Void in
// User finished with these assets
}, completion: nil)
//endbsimpagepicker
[Since I was looking for an answer too and couldn't find it, I'll add this as an answer so in the future people will find it easier. Thanks to @Allen who provided the answer in the comments.]
You have to add the Photos Framework by writing:
import Photos
...at the beginning of your ViewController's source code.
That will allow you to use PHAsset
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With