fastred / AHKActionSheet

An alternative to the UIActionSheet inspired by the Spotify app.
MIT License
1.16k stars 130 forks source link

Swift interoperability through CocoaPods #24

Closed fastred closed 9 years ago

fastred commented 9 years ago

There's an issue with AHKActionSheet when it's used from Swift app through CocoaPods: https://twitter.com/arnaud_momo/status/621242327537946624

zigzagg16 commented 9 years ago

Indeed. Actually I just put the files in my project, and it works. But would be much better with Cocoapods !

lucasecf commented 9 years ago

Hey guys, it's perfectly fine to use this lib or any other in Objective-C with Swift through Cocoapods.

In the bridging header file, just use the @import version, like below:

//
//  Use this file to import your target's public headers that you would like to expose to Swift.
//

@import AHKActionSheet;

and you can use the AHKActionSheet normally

let actionSheet = AHKActionSheet(title: "teste")
actionSheet.addButtonWithTitle("opt 1", type: .Default) { (actionSheet)  in
    print("tapped")
}

actionSheet.show()
fastred commented 9 years ago

@lucasecf Thanks! I'm closing this issue.

karnakar commented 8 years ago

Hi,

I'm facing same issue, sample code

actionSheet.addButtonWithTitle("title", type: AHKActionSheetButtonType.Default, handler: { (AHKActionSheet) in // unable to get to this line on selection })