MortimerGoro / MGSwipeTableCell

An easy to use UITableViewCell subclass that allows to display swippable buttons with a variety of transitions.
MIT License
6.96k stars 1.08k forks source link

Swift 3.0 #232

Open patthehuman opened 8 years ago

patthehuman commented 8 years ago

I noticed some other users having issues with swift3 syntax. It seems ios10 and swift3 breaks a few things, has anyone been able to get this working?

MortimerGoro commented 8 years ago

I'm going to improve the ObjC annotations for Swift and add a full Swift sample

gujinku commented 8 years ago

Hi @MortimerGoro , I got the following warning and the swipe feature cannot work in Swift3 project now. It's urgent. How can I fix it?

Instance method 'swipeTableCell(:swipeButtonsFor:swipeSettings:expansionSettings:)' nearly matches optional requirement 'swipeTableCell(:swipeButtonsFor:swipeSettings:expansionSettings:)' of protocol 'MGSwipeTableCellDelegate'

Thank you!

gujinku commented 8 years ago

@MortimerGoro It seems Swift3 cannot interpret the Objective C functions correctly. I can FIX the above issue by rename swipeTableCell:canSwipe: to swipeTableCell_2:canSwipe: It has some conflict/ambguious with the following method: swipeTableCell:swipeButtonsForDirection:swipeSettings:expansionSettings:

However, it is just a workaround, hope you guys can provide the final solution!

Look forward to your reply!

spiking commented 8 years ago

@gujinku

What do you mean by

I can FIX the above issue by rename swipeTableCell_2:canSwipe: to swipeTableCell_2:canSwipe:

You say the same thing twice?

The problem at the moment is that

func swipeTableCell(_ cell: MGSwipeTableCell!, swipeButtonsFor direction: MGSwipeDirection, swipeSettings: MGSwipeSettings!, expansionSettings: MGSwipeExpansionSettings!) -> [AnyObject]! {

is not getting called. Any ideas?

Thanks!

gujinku commented 8 years ago

@spiking , sorry, it's a typo. I corrected it.

You should update the code in MGSwipeTableCell directly. That is, use a different name from the following one: swipeTableCell:swipeButtonsForDirection:swipeSettings:expansionSettings:

Eg. rename "swipeTableCell:canSwipe:" to "swipeTableCell_2:canSwipe:"

After finishing the above change, you'd better remove the files in the directory: '~/Library/Developer/Xcode/DerivedData/'

And then, rebuild your app.

MortimerGoro commented 8 years ago

I've pushed 1.5.6 version with Swift interoperation improvements. The swift 3.0 sample is ready too ;)

https://github.com/MortimerGoro/MGSwipeTableCell/tree/master/demo/MailAppDemoSwift

gujinku commented 8 years ago

@MortimerGoro I've updated the code to 1.5.6 version. It works! Thank you !

patthehuman commented 7 years ago

Did you set your cell as delegate? cell.delegate = self

On Tue, Jan 10, 2017 at 8:03 AM, Hai Huynh notifications@github.com wrote:

Hello, I'm using 1.5.6 version with XCode 8 but the delegate functions are not called

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MortimerGoro/MGSwipeTableCell/issues/232#issuecomment-271615742, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8FbZdU0hKIelu7k3QeQDF0-kD9SQfwks5rQ6u5gaJpZM4J_eX5 .

MarbleDaemon commented 7 years ago

Oh I just found it in MortimerGogo's example too. Thank you for pointing out. My bad.