Skip to content
This repository has been archived by the owner on Apr 11, 2021. It is now read-only.

Abstract protocol prevents conforming in swift 1.2 #45

Closed
haswalt opened this issue Jul 6, 2015 · 11 comments
Closed

Abstract protocol prevents conforming in swift 1.2 #45

haswalt opened this issue Jul 6, 2015 · 11 comments

Comments

@haswalt
Copy link
Contributor

haswalt commented Jul 6, 2015

Because of the abstract decleration of the protocol it's impossible to confirm to the ABPadLockScreenViewControllerProtocol because:

  1. Only declaring 1 method fails. The abstract method is also required to conform.
  2. Declaring both methods causes build errors due to duplicate method declerations.

We removed the abstract protocol from our fork to make it work in swift but that's not ideal. Secondly I'd like to know more why there is the abstract? It doesn't seem to provide a great deal other than confusion and 2 places for the code to reside.

@haswalt haswalt mentioned this issue Jul 6, 2015
@abury
Copy link
Owner

abury commented Jul 8, 2015

Hey @haswalt
Thanks for letting me know these issues. I haven't had a chance to make it play nice with swift yet, but I got a PR the same day you wrote this that apparently fixes up the issues so I'll probably use that.
Regarding the protocol abstraction, there were two logical protocols for the setup and implementation delegates that had separate methods, but both shared the need for a 'unlockWasCancelled'. In an effort to keep it DRY I decided to create an abstract protocol. Whilst this technically solved that issue, it has probably caused more issues than it has resolved, but that's the beauty of hindsight ;)

I'll check out your PR over the next few days. Is there a time frame you'd prefer this to be done by?

edit: just realised that PR was done by your crew!

@haswalt
Copy link
Contributor Author

haswalt commented Jul 8, 2015

Thanks @abury yeah my colleague submitted my changes as PR right after I posted this bug.

@abury
Copy link
Owner

abury commented Jul 9, 2015

This has been resolved in PR #48

@abury abury closed this as completed Jul 9, 2015
@ryanmeisters
Copy link

I seem to be having this issue still with version 3.3.0 with Swift 1.2.. @haswalt @abury any pointers?

I have a view controller that conforms to ABPadLockScreenViewControllerDelegate by implementing

func padLockScreenViewController(padLockScreenViewController: ABPadLockScreenViewController!, validatePin pin: String!) -> Bool
func unlockWasSuccessfulForPadLockScreenViewController(padLockScreenViewController: ABPadLockScreenViewController!)
func unlockWasUnsuccessful(falsePin: String!, afterAttemptNumber attemptNumber: Int, padLockScreenViewController: ABPadLockScreenViewController!)
func unlockWasCancelledForPadLockScreenViewController(padLockScreenViewController: ABPadLockScreenViewController!) 
func attemptsExpiredForPadLockScreenViewController(padLockScreenViewController: ABPadLockScreenViewController!)

But I still get a compiler error saying

Type 'MainViewController' does not conform to protocol ABPadLockScreenDelegate

Of course, if I try to conform to ABPadLockScreenDelegate by implementing

func unlockWasCancelledForPadLockScreenViewController(padLockScreenViewController: ABPadLockScreenAbstractViewController!)

the compiler complains about the conflicting unlockWasCancelledForPadLockScreenViewController: methods.

@abury
Copy link
Owner

abury commented Aug 31, 2015

Hey @ryanmeisters

I havne't had much of a chance to test this on any swift codebase yet. I've been changing jobs, moving countries and having issues with my GCC thats stopping me from compiling in the command line (which means I can't push new versions of this to cocoa pods) and the only way to resolve this is to do a complete reinstall.

It should start to slow down in the next week and i'm hoping to have a look at this in Swift and push a version thats more compatible. (Will probably update the example to use Swift as well)

In the mean time @haswalt will hopefully be able to guide us in the right direction.

@abury abury reopened this Aug 31, 2015
@abury
Copy link
Owner

abury commented Sep 9, 2015

@Jayvd well as happy as I am that this seems to be the best library, i'm sorry that I haven't managed to keep it up to date enough for you 😞 Life has been a bit crazy in the last few months after changing jobs and moving overseas and I haven't had the time to do it that i'd like.
I have my first weekend free in a long time this weekend, and a computer that properly runs GCC. I will do my very best to get it updated this weekend for you, with a swift example project.

I'm sorry again for taking so long and thanks so much for your patience 😄

abury added a commit that referenced this issue Sep 13, 2015
@abury
Copy link
Owner

abury commented Sep 13, 2015

This will be resolved in 3.4.0, to be released very soon.

@abury abury closed this as completed Sep 13, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@haswalt @abury @ryanmeisters and others