MGSwipeTableCell icon indicating copy to clipboard operation
MGSwipeTableCell copied to clipboard

Swift 3.0

Open patthehuman opened this issue 8 years ago • 9 comments

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?

patthehuman avatar Sep 17 '16 01:09 patthehuman

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

MortimerGoro avatar Sep 19 '16 07:09 MortimerGoro

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 avatar Sep 26 '16 07:09 gujinku

@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!

gujinku avatar Sep 26 '16 09:09 gujinku

@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!

spiking avatar Sep 26 '16 15:09 spiking

@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.

gujinku avatar Sep 27 '16 12:09 gujinku

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

MortimerGoro avatar Oct 01 '16 23:10 MortimerGoro

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

gujinku avatar Oct 08 '16 05:10 gujinku

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

On Tue, Jan 10, 2017 at 8:03 AM, Hai Huynh [email protected] 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 .

patthehuman avatar Jan 10 '17 16:01 patthehuman

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

MarbleDaemon avatar Jan 10 '17 16:01 MarbleDaemon