Skip to content

issue with swift and sulotion #14

@jessez1y4

Description

@jessez1y4

Hi uzysjung,

The thing is - in your protocol the required one is : - (void)UzysAssetsPickerController:(UzysAssetsPickerController *)picker didFinishPickingAssets:(NSArray *)assets;

if i rewrite this as swift, it will look like : func UzysAssetsPickerController(picker: UzysAssetsPickerController!, didFinishPickingAssets assets: NSArray! ) -> Void {
// var a = 1
// }

this will raise issue because in ojbc the function name is UzysAssetsPickerControllers didFinishPickingAssets, but in swift the function name becomes to UzysAssetsPickerControllers

so this line will break ( var picker = UzysAssetsPickerController() ) because swift don't know if its a class name or a function name..

I tested by change your original protocol from UzysAssetsPickerController didFinishPickingAssets to UzysAssetsPickerControllers didFinishPickingAssets (simply added a s) and then change the name as UzysAssetsPickerControllers(..., didFinishPickingAssets ) and it works very well!

import UIKit

class PhotoViewController: UIViewController, UzysAssetsPickerControllerDelegate {

@IBAction func click(sender: AnyObject) {
    println("haha")

    var picker = UzysAssetsPickerController()
    picker.delegate = self;
    picker.maximumNumberOfSelectionVideo = 0
    picker.maximumNumberOfSelectionPhoto = 3
    self.presentViewController(picker, animated: true, completion: {() -> Void in
        println()
    })
}

// THIS ONE DOES NOT WORK!
// func UzysAssetsPickerController(picker: UzysAssetsPickerController!, didFinishPickingAssets assets: NSArray! ) -> Void {
// var a = 1
// }

// THIS ONE DOES AFTER I CHANGE THE PROTOCAL NAME from UzysAssetsPickerController to UzysAssetsPickerControllers
func UzysAssetsPickerControllers(picker: UzysAssetsPickerController!, didFinishPickingAssets assets: [AnyObject]!) {
var a = 1
}

So simply you just need to change that protocol name and all issue fixed. even a project by swift can use your lib:)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions