doorbell / ios-sdk

The Doorbell iOS SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Swift support

reydanro opened this issue · comments

Any plans or actively working towards a Doorbell SDKin Swift?
Wondering if I should start porting the current ObjC one.

As a fast solution I ended up using the ObjC sdk in the swift project and it was very easy to integrate.
So easy, that I think it becomes questionable whether a pure swift implementation is really needed. It would also mean double the work on updates or bug fixes.

It's the standard way of using any ObjC class in Swift.
You need to setup a bridging header, import the two headers from Doorbell SDK and then when you want to display the dialog you can do something like this:

    var feedback = Doorbell(apiKey: "", appId: "")
    feedback.showFeedbackDialogInViewController(self, completion: nil)

My suggestion would be to add a new repo on github with a sample project in swift. Can't get more clear than that for new users :)

Thanks too

Awesome, will try and do that :)

I'll close this once I have the demo repo ready!

Thanks again!

What is the podfile entry for doorbell? I've tried adding:
pod 'doorbell/ios-sdk'
But that didnt work.

You need to use pod 'Doorbell', '~> 0.1'

@manavo I can translate this into swift if you want and is this sdk connected via wifi too?

Thanks for the offer, but since it does already work with Swift it probably isn't needed.

Not sure I understand what you mean by asking if it connects via wifi though?

If I could add my 2 cents. It works on Swift if you add the bridging headers etc. This is the only library that I use (and pay for) where I have to do that. It would definitely reduce the barrier to entry if there was a swift version where that wasn't necessary.

I definitely agree it isn't ideal, just hard to try and support both Objective C and Swift. Longer term Objective C will die out (I assume), but for now it is important to support both.

I need to look into the opposite being an option, importing a Swift library into Objective C. If that's an option, it might warrant a rewrite from ObjC to Swift for the SDK. Needs investigating first though.

Maintaining both SDKs in parallel would be a fair bit of work!

Yeah, fair enough. Good plan.

It's taken a while, but with Cocoapods having use_frameworks! the bridging headers aren't needed anymore. I've also updated all the documentation to include both Swift and Objective C, so I'll close this now! Sorry it has taken so long!